Class: MoneyHeuristics::Analyzer
- Inherits:
-
Object
- Object
- MoneyHeuristics::Analyzer
- Defined in:
- lib/money-heuristics/analyzer.rb
Instance Attribute Summary collapse
-
#currencies ⇒ Object
Returns the value of attribute currencies.
-
#methods ⇒ Object
Returns the value of attribute methods.
-
#search_tree ⇒ Object
readonly
Returns the value of attribute search_tree.
-
#str ⇒ Object
Returns the value of attribute str.
-
#words ⇒ Object
readonly
Returns the value of attribute words.
Instance Method Summary collapse
-
#initialize(str, search_tree) ⇒ Analyzer
constructor
A new instance of Analyzer.
- #process(filters) ⇒ Object
Constructor Details
#initialize(str, search_tree) ⇒ Analyzer
Returns a new instance of Analyzer.
6 7 8 9 10 11 12 13 |
# File 'lib/money-heuristics/analyzer.rb', line 6 def initialize(str, search_tree) @str = (str || '').dup @search_tree = search_tree @currencies = [] @methods = { iso_code: :search_by_iso_code, symbol: :search_by_symbol, name: :search_by_name } end |
Instance Attribute Details
#currencies ⇒ Object
Returns the value of attribute currencies.
4 5 6 |
# File 'lib/money-heuristics/analyzer.rb', line 4 def currencies @currencies end |
#methods ⇒ Object
Returns the value of attribute methods.
4 5 6 |
# File 'lib/money-heuristics/analyzer.rb', line 4 def methods @methods end |
#search_tree ⇒ Object (readonly)
Returns the value of attribute search_tree.
3 4 5 |
# File 'lib/money-heuristics/analyzer.rb', line 3 def search_tree @search_tree end |
#str ⇒ Object
Returns the value of attribute str.
4 5 6 |
# File 'lib/money-heuristics/analyzer.rb', line 4 def str @str end |
#words ⇒ Object (readonly)
Returns the value of attribute words.
3 4 5 |
# File 'lib/money-heuristics/analyzer.rb', line 3 def words @words end |
Instance Method Details
#process(filters) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/money-heuristics/analyzer.rb', line 15 def process(filters) format return [] if str.empty? filter_methods(filters).each { |method| send(method) } prepare_reply end |