Module: Quandl::Sandbox::Attributes
- Extended by:
- ActiveSupport::Concern
- Included in:
- Configuration, Repository
- Defined in:
- lib/quandl/sandbox/attributes.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#attributes ⇒ Object
36 37 38 |
# 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) ⇒ Object
40 41 42 43 44 45 46 47 |
# 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 |
#initialize(*args) ⇒ Object
31 32 33 34 |
# File 'lib/quandl/sandbox/attributes.rb', line 31 def initialize(*args) self.attributes = args. super if defined?(super) end |