Class: Textoken::Searcher

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#valuesObject (readonly)

Returns the value of attribute values.



6
7
8
# File 'lib/textoken/searcher.rb', line 6

def values
  @values
end

#yamlObject (readonly)

Returns the value of attribute yaml.



6
7
8
# File 'lib/textoken/searcher.rb', line 6

def yaml
  @yaml
end

Instance Method Details

#regexpsObject



14
15
16
17
# File 'lib/textoken/searcher.rb', line 14

def regexps
  match_keys
  @regexps.map.each { |r| Regexp.new(r) }
end