Sha256: a7e544b3c136123e36e80b9e93abbdaea4ba643f02a5c796f86e415e67af84d6
Contents?: true
Size: 631 Bytes
Versions: 4
Compression:
Stored size: 631 Bytes
Contents
# All code in the gem is namespaced under this module. module CoderWally # Stores the users accounts class Account # Dynamically create account properties def initialize(collection_of_accounts) collection_of_accounts.each do |account, value| create_accessor account set_accessor_value account, value end end # create the attribute accessor def create_accessor(name) singleton_class.class_eval { attr_accessor "#{name}" } end # assign the value to the accessor def set_accessor_value(name, value) instance_variable_set("@#{name}", value) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
coder_wally-1.0.2 | lib/coder_wally/account.rb |
coder_wally-1.0.1 | lib/coder_wally/account.rb |
coder_wally-1.0.0 | lib/coder_wally/account.rb |
coder_wally-0.1.2 | lib/coder_wally/account.rb |