Class: Quandl::Data::Table

Inherits:
Object
  • Object
show all
Includes:
Loggable, Operations
Defined in:
lib/quandl/data/table.rb,
lib/quandl/data/table/loggable.rb,
lib/quandl/data/table/operations.rb

Defined Under Namespace

Modules: Loggable, Operations

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable

#to_csv, #to_h

Methods included from Operations

#collapse, #collapse=, #frequency, #frequency=, #limit, #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=, #trim_end, #trim_start

Constructor Details

#initialize(*args) ⇒ Table

Returns a new instance of Table.



16
17
18
19
# File 'lib/quandl/data/table.rb', line 16

def initialize(*args)
  self.pristine_data = args.first
  self.attributes = args.extract_options!
end

Instance Attribute Details

#pristine_dataObject

Returns the value of attribute pristine_data.



14
15
16
# File 'lib/quandl/data/table.rb', line 14

def pristine_data
  @pristine_data
end

Instance Method Details

#assign_attributes(attrs) ⇒ Object

mass assignment protection



43
44
45
46
47
# File 'lib/quandl/data/table.rb', line 43

def assign_attributes(attrs)
  attrs.each do |name, value|
    self.send("#{name}=", value) if self.respond_to?("#{name}=")
  end
end

#attributesObject



33
34
35
# File 'lib/quandl/data/table.rb', line 33

def attributes
  @attributes ||= {}
end

#attributes=(attrs) ⇒ Object



37
38
39
40
# File 'lib/quandl/data/table.rb', line 37

def attributes=(attrs)
  assign_attributes(attrs)
  attributes
end

#data_arrayObject



21
22
23
# File 'lib/quandl/data/table.rb', line 21

def data_array
  @data_array ||= parse( pristine_data )
end

#data_array=(data) ⇒ Object



25
26
27
# File 'lib/quandl/data/table.rb', line 25

def data_array=(data)
  @data_array = parse(data)
end

#data_array?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/quandl/data/table.rb', line 29

def data_array?
  @data_array.present?
end