Class: Harvest::Resource::Base

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

Direct Known Subclasses

TimeEntry, User

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attr_map) ⇒ Base

Returns a new instance of Base.



16
17
18
19
20
# File 'lib/harvest/resource/base.rb', line 16

def initialize attr_map
  attr_map.each do |attribute, value|
    instance_variable_set("@#{attribute}", value)
  end
end

Class Method Details

.attributes(*attrs) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/harvest/resource/base.rb', line 5

def attributes *attrs
  if attrs.any?
    @@attributes = attrs
    attr_reader *attrs
    self
  else
    @@attributes
  end
end

Instance Method Details

#attributesObject



22
23
24
# File 'lib/harvest/resource/base.rb', line 22

def attributes
  self.class.attributes
end