Class: Bitstamp::Model
- Inherits:
-
Object
- Object
- Bitstamp::Model
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Model, ActiveModel::Validations
- Defined in:
- lib/bitstamp/model.rb
Instance Method Summary collapse
-
#attributes ⇒ Object
Returns a hash with the current instance variables.
-
#attributes=(attributes = {}) ⇒ Object
Set the attributes based on the given hash.
-
#initialize(attributes = {}) ⇒ Model
constructor
A new instance of Model.
Constructor Details
#initialize(attributes = {}) ⇒ Model
Returns a new instance of Model.
8 9 10 |
# File 'lib/bitstamp/model.rb', line 8 def initialize(attributes = {}) self.attributes = attributes end |
Instance Method Details
#attributes ⇒ Object
Returns a hash with the current instance variables
23 24 25 |
# File 'lib/bitstamp/model.rb', line 23 def attributes Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }] end |
#attributes=(attributes = {}) ⇒ Object
Set the attributes based on the given hash
16 17 18 19 20 |
# File 'lib/bitstamp/model.rb', line 16 def attributes=(attributes = {}) attributes.each do |name, value| send("#{name}=", value) end end |