Module: Quandl::Data::Attributes
- Extended by:
- ActiveSupport::Concern
- Included in:
- Quandl::Data
- Defined in:
- lib/quandl/data/attributes.rb
Instance Method Summary collapse
- #assign_attributes(attrs) ⇒ Object
- #attributes ⇒ Object
- #attributes=(attrs) ⇒ Object
- #headers ⇒ Object
- #headers=(value) ⇒ Object
- #headers? ⇒ Boolean
- #initialize(*args) ⇒ Object
Instance Method Details
#assign_attributes(attrs) ⇒ Object
30 31 32 33 34 |
# File 'lib/quandl/data/attributes.rb', line 30 def assign_attributes(attrs) attrs.each do |name, value| self.send("#{name}=", value) if self.respond_to?("#{name}=") end end |
#attributes ⇒ Object
23 24 25 |
# File 'lib/quandl/data/attributes.rb', line 23 def attributes @attributes ||= {} end |
#attributes=(attrs) ⇒ Object
26 27 28 29 |
# File 'lib/quandl/data/attributes.rb', line 26 def attributes=(attrs) assign_attributes(attrs) attributes end |
#headers ⇒ Object
15 16 17 18 |
# File 'lib/quandl/data/attributes.rb', line 15 def headers ensure_data_is_cleaned @headers end |
#headers=(value) ⇒ Object
12 13 14 |
# File 'lib/quandl/data/attributes.rb', line 12 def headers=(value) @headers = value.flatten if value.kind_of?(Array) end |
#headers? ⇒ Boolean
19 20 21 |
# File 'lib/quandl/data/attributes.rb', line 19 def headers? headers.present? end |
#initialize(*args) ⇒ Object
7 8 9 10 |
# File 'lib/quandl/data/attributes.rb', line 7 def initialize(*args) self.pristine_data = args.first self.attributes = args. end |