Module: YADM::Entity

Defined in:
lib/yadm/entity.rb

Defined Under Namespace

Modules: DSL

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(including_class) ⇒ Object


21
22
23
24
# File 'lib/yadm/entity.rb', line 21

def included(including_class)
  including_class.extend(DSL)
  including_class.attribute(:id)
end

Instance Method Details

#attributesObject


11
12
13
# File 'lib/yadm/entity.rb', line 11

def attributes
  @attributes.dup
end

#initialize(new_attributes) ⇒ Object


3
4
5
6
7
8
9
# File 'lib/yadm/entity.rb', line 3

def initialize(new_attributes)
  @attributes = {}
  
  self.class.attributes.each do |attr_name|
    @attributes[attr_name] = fetch(new_attributes, attr_name)
  end
end