Class: Text::Gen::Filter::Swap
Constant Summary collapse
- DIGIT_WORDS =
{ "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five", "6" => "six", "7" => "seven", "8" => "eight", "9" => "nine" }.freeze
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
#result(context, result) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/text/gen/filter/swap.rb', line 13 def result(context, result) return result if @depth && context.depth != @depth text = result.text text = swap(text, key, value) return result if text == result.text Result.from(result, text:, type: component_key) end |