Class: Quandl::Data::Table
- Inherits:
-
Object
- Object
- Quandl::Data::Table
- Includes:
- Operations
- Defined in:
- lib/quandl/data/table.rb,
lib/quandl/data/table/operations.rb
Defined Under Namespace
Modules: Operations
Instance Method Summary collapse
-
#assign_attributes(attrs) ⇒ Object
mass assignment protection.
- #attributes ⇒ Object
- #attributes=(attrs) ⇒ Object
- #data_array ⇒ Object
- #data_array=(data) ⇒ Object
-
#initialize(*args) ⇒ Table
constructor
A new instance of Table.
Methods included from Operations
#collapse, #collapse=, #frequency, #frequency=, #parse, #sort_ascending, #sort_ascending!, #sort_descending, #sort_descending!, #sort_order, #to_csv, #to_date, #to_date!, #to_h, #to_jd, #to_jd!, #transform, #transform=
Constructor Details
#initialize(*args) ⇒ Table
Returns a new instance of Table.
12 13 14 15 16 |
# File 'lib/quandl/data/table.rb', line 12 def initialize(*args) data = args.first self.attributes = args. self.data_array = data end |
Instance Method Details
#assign_attributes(attrs) ⇒ Object
mass assignment protection
36 37 38 39 40 |
# File 'lib/quandl/data/table.rb', line 36 def assign_attributes(attrs) attrs.each do |name, value| self.send("#{name}=", value) if self.respond_to?("#{name}=") end end |
#attributes ⇒ Object
26 27 28 |
# File 'lib/quandl/data/table.rb', line 26 def attributes @attributes ||= {} end |
#attributes=(attrs) ⇒ Object
30 31 32 33 |
# File 'lib/quandl/data/table.rb', line 30 def attributes=(attrs) assign_attributes(attrs) attributes end |
#data_array ⇒ Object
18 19 20 |
# File 'lib/quandl/data/table.rb', line 18 def data_array @data_array ||= [] end |
#data_array=(data) ⇒ Object
22 23 24 |
# File 'lib/quandl/data/table.rb', line 22 def data_array=(data) @data_array = parse(data) end |