Class: Enstratus::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/enstratus/resource.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Resource

Returns a new instance of Resource.



9
10
11
12
# File 'lib/enstratus/resource.rb', line 9

def initialize(attrs = {})
  @attributes = {}
  update_attributes(attrs)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/enstratus/resource.rb', line 3

def attributes
  @attributes
end

Class Method Details

.inherited(sub) ⇒ Object



5
6
7
# File 'lib/enstratus/resource.rb', line 5

def self.inherited(sub)
  sub.send :extend, Enstratus::ResourceClassMethods
end

Instance Method Details

#update_attributes(attrs) ⇒ Object



18
19
20
# File 'lib/enstratus/resource.rb', line 18

def update_attributes(attrs)
  attrs.each {|k,v| send(:"#{k}=", v)}
end