module Quandl::Data::Attributes

Public Class Methods

new(*args) click to toggle source
# File lib/quandl/data/attributes.rb, line 25
def initialize(*args)
  # passed an instance of quandl data?
  if args.first.kind_of?(Quandl::Data)
    @attributes = args.first.attributes
  elsif args.first.present?
    self.pristine_data = args.first
  end
  valid? unless cleaned?
end

Public Instance Methods

as_json() click to toggle source
# File lib/quandl/data/attributes.rb, line 40
def as_json
  ensure_json_support
  data_array.try(:as_json)
end
cleaned?() click to toggle source
# File lib/quandl/data/attributes.rb, line 19
def cleaned?
  read_attribute(:cleaned) == true
end
headers=(value) click to toggle source
# File lib/quandl/data/attributes.rb, line 15
def headers=(value)
  write_attribute(:headers, Array(value).flatten )
end
to_json() click to toggle source
# File lib/quandl/data/attributes.rb, line 35
def to_json
  ensure_json_support
  data_array.try(:to_json)
end

Private Instance Methods

ensure_json_support() click to toggle source
# File lib/quandl/data/attributes.rb, line 47
def ensure_json_support
  require 'active_support/core_ext/object' unless Object.respond_to?(:as_json)
end