Class: Sprig::Seed::AttributeCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sprig/seed/attribute_collection.rb

Defined Under Namespace

Classes: AttributeNotFoundError

Instance Method Summary collapse

Constructor Details

#initialize(attrs_hash) ⇒ AttributeCollection

Returns a new instance of AttributeCollection.



8
9
10
# File 'lib/sprig/seed/attribute_collection.rb', line 8

def initialize(attrs_hash)
  @attrs_hash = attrs_hash.to_hash
end

Instance Method Details

#find_by_name(name) ⇒ Object



12
13
14
# File 'lib/sprig/seed/attribute_collection.rb', line 12

def find_by_name(name)
  attributes.detect {|attribute| attribute.name == name.to_s } || attribute_not_found(name)
end