Class: Textoken::Searcher
- Inherits:
-
Object
- Object
- Textoken::Searcher
- Defined in:
- lib/textoken/searcher.rb
Overview
This class reads YAML file under searchables/values, returns array of regexps representing values passed as an argument todo: add regexp support
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
-
#yaml ⇒ Object
readonly
Returns the value of attribute yaml.
Instance Method Summary collapse
-
#initialize(values) ⇒ Searcher
constructor
A new instance of Searcher.
- #regexps ⇒ Object
Constructor Details
#initialize(values) ⇒ Searcher
Returns a new instance of Searcher.
8 9 10 11 12 |
# File 'lib/textoken/searcher.rb', line 8 def initialize(values) @values = check_and_init_values(values) @yaml = load_file @regexps = [] end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
6 7 8 |
# File 'lib/textoken/searcher.rb', line 6 def values @values end |
#yaml ⇒ Object (readonly)
Returns the value of attribute yaml.
6 7 8 |
# File 'lib/textoken/searcher.rb', line 6 def yaml @yaml end |
Instance Method Details
#regexps ⇒ Object
14 15 16 17 |
# File 'lib/textoken/searcher.rb', line 14 def regexps match_keys @regexps.map.each { |r| Regexp.new(r) } end |