Sha256: a7c2bd1fcf58dad27dff6bbca6f89aaa38f7e8f3b8621db6eb75f8e0e57cc716

Contents?: true

Size: 862 Bytes

Versions: 9

Compression:

Stored size: 862 Bytes

Contents

require 'quandl/data/table/loggable'
require 'quandl/data/table/operations'

module Quandl
module Data
  
class Table

  include Operations
  include Loggable
  
  delegate *Array.forwardable_methods, to: :data_array
  
  attr_accessor :pristine_data

  def initialize(*args)
    self.pristine_data = args.first
    self.attributes = args.extract_options!
  end
  
  def data_array
    @data_array ||= parse( pristine_data )
  end

  def data_array=(data)
    @data_array = parse(data)
  end
  
  def data_array?
    @data_array.present?
  end

  def attributes
    @attributes ||= {}
  end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
quandl_data-0.1.4 lib/quandl/data/table.rb
quandl_data-0.1.3 lib/quandl/data/table.rb
quandl_data-0.1.2 lib/quandl/data/table.rb
quandl_data-0.1.0 lib/quandl/data/table.rb
quandl_data-0.0.12 lib/quandl/data/table.rb
quandl_data-0.0.11 lib/quandl/data/table.rb
quandl_data-0.0.10 lib/quandl/data/table.rb
quandl_data-0.0.9 lib/quandl/data/table.rb
quandl_data-0.0.8 lib/quandl/data/table.rb