module Quandl::Sandbox::Attributes

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/quandl/sandbox/attributes.rb, line 31
def initialize(*args)
  self.attributes = args.extract_options!
  super if defined?(super)
end

Public Instance Methods

attributes() click to toggle source
# File lib/quandl/sandbox/attributes.rb, line 36
def attributes
  self.class.attributes.inject({}){|m,name| m.merge({ name.to_sym => self.send(name) }) }
end
attributes=(pairs) click to toggle source
# File lib/quandl/sandbox/attributes.rb, line 40
def attributes=(pairs)
  # ensure symbolic keys
  pairs.symbolize_keys!
  # assign each acceptable pair
  self.class.attributes.each do |name|
    self.send("#{name}=", pairs[name] ) if pairs[name]
  end
end