Sha256: 1a52a049b2e2f0e3d6dea4ebc2e9151abef18d4b58f80f1f03019a77230c4305
Contents?: true
Size: 826 Bytes
Versions: 18
Compression:
Stored size: 826 Bytes
Contents
module Bitstamp class Model attr_accessor :error, :message 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
18 entries across 18 versions & 5 rubygems