From 7778352d99bdb7c74e658dff4863bd37cfc5e88c Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Thu, 29 Jan 2026 11:12:47 -0700 Subject: [PATCH] Added Rails helpers Necessary to extract from the `Filters` module since the current implementation uses a nested class. There's a couple of reasons why this is important: * Use of a class is unnecessary and wasteful since there is no state. This is also known as the link:https://alchemists.io/articles/ruby_antipatterns#_nonclasses[Nonclass] antipattern. * Due to the class having no state, the functionalitity can be fully encapsulated within a module as purely functional methods. * Modules are the most lightweight and performant objects in Ruby. We'll soon be able to replace the nested `Filters` class with this implementation. Milestone: minor --- lib/trmnl/liquid/rails_helpers.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/trmnl/liquid/rails_helpers.rb diff --git a/lib/trmnl/liquid/rails_helpers.rb b/lib/trmnl/liquid/rails_helpers.rb new file mode 100644 index 0000000..3b67c34 --- /dev/null +++ b/lib/trmnl/liquid/rails_helpers.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "action_view" + +module TRMNL + module Liquid + module RailsHelpers + extend ActionView::Helpers::TextHelper + extend ActionView::Helpers::NumberHelper + end + end +end