Class: ActiveRecord::Embedded::Index::Collection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/active_record/embedded/index/collection.rb

Overview

The collection of indexes that exist on an embedded model.

Instance Method Summary collapse

Constructor Details

#initializeCollection

Returns a new instance of Collection


12
13
14
# File 'lib/active_record/embedded/index/collection.rb', line 12

def initialize
  @indexes = {}
end

Instance Method Details

#<<(index) ⇒ Object

Add a new index.


17
18
19
# File 'lib/active_record/embedded/index/collection.rb', line 17

def <<(index)
  @indexes[index.name] = index
end

#eachObject

Iterate over all indexes.


22
23
24
# File 'lib/active_record/embedded/index/collection.rb', line 22

def each
  @indexes.each { |_name, index| yield index }
end