Class: Seasy::Index
- Inherits:
-
Object
- Object
- Seasy::Index
- Defined in:
- lib/seasy/index.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #add(searchee, target, options = {}) ⇒ Object
- #clear ⇒ Object
-
#initialize(name = 'default') ⇒ Index
constructor
A new instance of Index.
- #remove(target) ⇒ Object
- #search(query) ⇒ Object
Constructor Details
#initialize(name = 'default') ⇒ Index
Returns a new instance of Index.
23 24 25 26 27 |
# File 'lib/seasy/index.rb', line 23 def initialize name = 'default' @name = name @storage = Configuration.instance.storage.new @storage.name = name if @storage.respond_to? :name= end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/seasy/index.rb', line 21 def name @name end |
Class Method Details
Instance Method Details
#add(searchee, target, options = {}) ⇒ Object
42 43 44 45 |
# File 'lib/seasy/index.rb', line 42 def add searchee, target, = {} [:source] = target if [:source].nil? save target, fragmentize( searchee ), end |
#clear ⇒ Object
51 52 53 |
# File 'lib/seasy/index.rb', line 51 def clear @storage.clear end |
#remove(target) ⇒ Object
55 56 57 |
# File 'lib/seasy/index.rb', line 55 def remove target @storage.remove target end |
#search(query) ⇒ Object
47 48 49 |
# File 'lib/seasy/index.rb', line 47 def search query @storage.search query.downcase end |