Class: Editables::FieldsCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/editables/fields_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(editables_config) ⇒ FieldsCollection

Returns a new instance of FieldsCollection.



4
5
6
# File 'lib/editables/fields_collection.rb', line 4

def initialize(editables_config)
  @collection = to_hash(editables_config)
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



3
4
5
# File 'lib/editables/fields_collection.rb', line 3

def collection
  @collection
end

Instance Method Details

#[](key) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/editables/fields_collection.rb', line 8

def [](key)
  begin
    collection.fetch(key)
  rescue
    collection.fetch("editables/field").fetch(key)
  end
end