mirror of
https://github.com/usetrmnl/trmnl-liquid.git
synced 2026-04-29 13:43:18 -07:00
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
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user