Class: Quandl::Sandbox::Dataset
- Inherits:
-
Object
- Object
- Quandl::Sandbox::Dataset
- Defined in:
- lib/quandl/sandbox/dataset.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#column_names ⇒ Object
Returns the value of attribute column_names.
-
#data ⇒ Object
Returns the value of attribute data.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#source_code ⇒ Object
Returns the value of attribute source_code.
Class Method Summary collapse
Instance Method Summary collapse
- #full_code ⇒ Object
- #full_code=(value) ⇒ Object
-
#initialize(output) ⇒ Dataset
constructor
A new instance of Dataset.
- #inspect ⇒ Object
Constructor Details
#initialize(output) ⇒ Dataset
Returns a new instance of Dataset.
11 12 13 14 15 16 17 18 |
# File 'lib/quandl/sandbox/dataset.rb', line 11 def initialize(output) rows = output.split("\n") self.full_code = rows.shift.strip self.name = rows.shift.strip self.description = rows.shift.strip self.column_names = rows.shift self.data = rows.join("\n").strip end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/quandl/sandbox/dataset.rb', line 3 def code @code end |
#column_names ⇒ Object
Returns the value of attribute column_names.
3 4 5 |
# File 'lib/quandl/sandbox/dataset.rb', line 3 def column_names @column_names end |
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/quandl/sandbox/dataset.rb', line 3 def data @data end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/quandl/sandbox/dataset.rb', line 3 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/quandl/sandbox/dataset.rb', line 3 def name @name end |
#source_code ⇒ Object
Returns the value of attribute source_code.
3 4 5 |
# File 'lib/quandl/sandbox/dataset.rb', line 3 def source_code @source_code end |
Class Method Details
.from_output(outputs) ⇒ Object
5 6 7 8 9 |
# File 'lib/quandl/sandbox/dataset.rb', line 5 def self.from_output(outputs) outputs.split("----\n").collect do |output| self.new(output) end end |
Instance Method Details
#full_code ⇒ Object
37 38 39 |
# File 'lib/quandl/sandbox/dataset.rb', line 37 def full_code [source_code, code].join('/') end |
#full_code=(value) ⇒ Object
31 32 33 34 35 |
# File 'lib/quandl/sandbox/dataset.rb', line 31 def full_code=(value) value = value.split('/') self.source_code = value[0] self.code = value[1] end |
#inspect ⇒ Object
20 21 22 23 24 |
# File 'lib/quandl/sandbox/dataset.rb', line 20 def inspect "<##{self.class.name}" + [:full_code, :name, :description, :column_names].inject({}){|m,k| m[k] = self.send(k); m }.to_s + " >" end |