Module: Ripple::Indexes::ClassMethods

Defined in:
lib/ripple/indexes.rb

Instance Method Summary collapse

Instance Method Details

#index(key, type, &block) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/ripple/indexes.rb', line 32

def index(key, type, &block)
  if block_given?
    indexes[key] = Index.new(key, type, &block)
  else
    indexes[key] = Index.new(key, type)
  end
end

#indexesObject

Indexes defined on the document.



17
18
19
# File 'lib/ripple/indexes.rb', line 17

def indexes
  @indexes ||= {}.with_indifferent_access
end

#indexes=(idx) ⇒ Object



21
22
23
# File 'lib/ripple/indexes.rb', line 21

def indexes=(idx)
  @indexes = idx
end

#inherited(subclass) ⇒ Object



11
12
13
14
# File 'lib/ripple/indexes.rb', line 11

def inherited(subclass)
  super
  subclass.indexes = indexes.dup
end

#property(key, type, options = {}) ⇒ Object



25
26
27
28
29
30
# File 'lib/ripple/indexes.rb', line 25

def property(key, type, options={})
  if indexed = options.delete(:index)
    indexes[key] = Index.new(key, type, indexed)
  end
  super
end