Class: Ion::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/ion/index.rb

Overview

An index

You can subclass me by reimplementing #index, #deindex and #search.

Direct Known Subclasses

Ion::Indices::Sort, Ion::Indices::Text

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, options, args={}, &blk)
  @name    = name
  @options = options
  @lambda  = blk  if block_given?
  @lambda  ||= Proc.new { self.send(name) }
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/ion/index.rb', line 6

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/ion/index.rb', line 7

def options
  @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