Class: Text::Gen::Filter::Meta
Overview
Meta adds meta tags to the result
Instance Method Summary collapse
Methods inherited from Base
#component_key, filter_key, filter_name, #initialize, #key, #to_s, #type, #value
Constructor Details
This class inherits a constructor from Text::Gen::Filter::Base
Instance Method Details
#meta_value(result) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/text/gen/filter/meta.rb', line 17 def (result) case value when "_text_" result.text when "_value_" result.value.to_s when "_multiplier_" result.multiplier.to_s when "_words_" result.text.split(/\s+/).length.to_s when "_length_" result.text.length.to_s else value end end |
#result(context, result) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/text/gen/filter/meta.rb', line 8 def result(context, result) return result if @depth && context.depth != @depth = Text::Gen::Meta.append_kv(result..dup, key, (result)) return result if == result. Result.from(result, type: component_key, meta: ) end |