Class: Ion::Index
- Inherits:
-
Object
- Object
- Ion::Index
- Defined in:
- lib/ion/index.rb
Overview
An index
You can subclass me by reimplementing #index, #deindex and #search.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .deindex(record) ⇒ Object
-
.del(record) ⇒ Object
Completely obliterates traces of a record from the indices.
Instance Method Summary collapse
-
#index(record) ⇒ Object
Indexes a record.
-
#initialize(name, options, args = {}, &blk) ⇒ Index
constructor
A new instance of Index.
-
#search(what, args = {}) ⇒ Object
Returns a key (set) of results.
Constructor Details
#initialize(name, options, args = {}, &blk) ⇒ Index
Returns a new instance of Index.
9 10 11 12 13 14 |
# File 'lib/ion/index.rb', line 9 def initialize(name, , args={}, &blk) @name = name @options = @lambda = blk if block_given? @lambda ||= Proc.new { self.send(name) } end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/ion/index.rb', line 6 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/ion/index.rb', line 7 def @options end |
Class Method Details
.deindex(record) ⇒ Object
20 21 |
# File 'lib/ion/index.rb', line 20 def self.deindex(record) end |
.del(record) ⇒ Object
Completely obliterates traces of a record from the indices
24 25 26 27 |
# File 'lib/ion/index.rb', line 24 def self.del(record) self.deindex record references_key(record).del end |
Instance Method Details
#index(record) ⇒ Object
Indexes a record
17 18 |
# File 'lib/ion/index.rb', line 17 def index(record) end |
#search(what, args = {}) ⇒ Object
Returns a key (set) of results
30 31 |
# File 'lib/ion/index.rb', line 30 def search(what, args={}) end |