Sha256: 58b551c6676e93ed85c1902fb712b112caa2d1f398b6b7042d255665ff40a715
Contents?: true
Size: 790 Bytes
Versions: 2
Compression:
Stored size: 790 Bytes
Contents
module Bitstamp class Model if ActiveModel::VERSION::MAJOR <= 3 include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming def initialize(attributes = {}) self.attributes = attributes end else include ActiveModel::Model end # Set the attributes based on the given hash def attributes=(attributes = {}) attributes.each do |name, value| begin send("#{name}=", value) rescue NoMethodError => e puts "Unable to assign #{name}. No such method." end end end # Returns a hash with the current instance variables def attributes Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bitstamp-0.2.6 | lib/bitstamp/model.rb |
bitstamp-0.2.5 | lib/bitstamp/model.rb |