class Quandl::Utility::Configuration
Public Class Methods
attributes()
click to toggle source
# File lib/quandl/utility/configuration.rb, line 11 def attributes @attributes ||= [] end
define_attributes(*attribute_names)
click to toggle source
# File lib/quandl/utility/configuration.rb, line 5 def define_attributes(*attribute_names) attribute_names.each do |key| define_attribute(key) end end
new(object = {})
click to toggle source
# File lib/quandl/utility/configuration.rb, line 25 def initialize(object = {}) self.attributes = object after_initialize end
Protected Class Methods
define_attribute(key)
click to toggle source
# File lib/quandl/utility/configuration.rb, line 17 def define_attribute(key) key = key.to_s attributes << key unless attributes.include?(key) define_method(key) { read_attribute(key) } define_method("#{key}=") { |value| write_attribute(key, value) } end
Public Instance Methods
after_initialize()
click to toggle source
# File lib/quandl/utility/configuration.rb, line 30 def after_initialize end
attributes()
click to toggle source
# File lib/quandl/utility/configuration.rb, line 43 def attributes @attributes ||= {} end
attributes=(attrs)
click to toggle source
# File lib/quandl/utility/configuration.rb, line 37 def attributes=(attrs) attrs.each do |key, value| send("#{key}=", value) if self.respond_to?("#{key}=") end end
to_h()
click to toggle source
# File lib/quandl/utility/configuration.rb, line 33 def to_h attributes end
Protected Instance Methods
read_attribute(key)
click to toggle source
# File lib/quandl/utility/configuration.rb, line 49 def read_attribute(key) attributes[key.to_s] end
write_attribute(key, value)
click to toggle source
# File lib/quandl/utility/configuration.rb, line 53 def write_attribute(key, value) attributes[key.to_s] = value end