module RemoveDataAttributes::TagOptionsFilter
Public Class Methods
[](data_attributes)
click to toggle source
# File lib/remove_data_attributes/tag_options_filter.rb, line 10 def [](data_attributes) module_cache[data_attributes] ||= module_for(data_attributes) end
Private Class Methods
module_cache()
click to toggle source
# File lib/remove_data_attributes/tag_options_filter.rb, line 16 def module_cache @module_cache ||= {} end
module_for(data_attributes)
click to toggle source
Calls superclass method
# File lib/remove_data_attributes/tag_options_filter.rb, line 20 def module_for(data_attributes) method_name = :tag_options processor = ::RemoveDataAttributes::Processor.new(data_attributes) ::Module.new do extend ::ActiveSupport::Concern included do |klass| patch = ::Module.new do define_method(method_name) do |options, escape = true| options.is_a?(::Hash) ? super(processor.call(options), escape) : super(options, escape) end private method_name if klass.private_method_defined?(method_name) end klass.prepend(patch) end end end