Sha256: 8f39af135920f689e07902b8e5931708fb564c8cc3bc72a4a8b02bf9f94b9368
Contents?: true
Size: 662 Bytes
Versions: 8
Compression:
Stored size: 662 Bytes
Contents
module Coinsetter class Model attr_accessor :error, :message include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming def initialize(attributes = {}) self.attributes = attributes end def attributes=(attributes = {}) attributes.each do |name, value| begin send("#{name.underscore}=", value) rescue NoMethodError => e puts "Unable to assign #{name.underscore} with value #{value}. No such method." end end end def attributes Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }] end end end
Version data entries
8 entries across 8 versions & 1 rubygems