Class: Harvest::Resource::Base
- Inherits:
-
Object
- Object
- Harvest::Resource::Base
- Defined in:
- lib/harvest/resource/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(attr_map) ⇒ Base
constructor
A new instance of Base.
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
#attributes ⇒ Object
22 23 24 |
# File 'lib/harvest/resource/base.rb', line 22 def attributes self.class.attributes end |