class Quandl::ModelBase

Public Class Methods

new(data, _options = {}) click to toggle source
# File lib/quandl/model/base.rb, line 3
def initialize(data, _options = {})
  @raw_data = ActiveSupport::HashWithIndifferentAccess.new(data.transform_keys { |k| Quandl::Util.methodize(k) })
end

Public Instance Methods

column_names() click to toggle source
# File lib/quandl/model/base.rb, line 11
def column_names
  @raw_data.keys.map(&:to_s).map(&:titleize)
end
data_fields() click to toggle source
# File lib/quandl/model/base.rb, line 7
def data_fields
  @raw_data.keys.map(&:to_s)
end
inspect() click to toggle source
# File lib/quandl/model/base.rb, line 19
def inspect
  @raw_data.to_s
end
to_a() click to toggle source
# File lib/quandl/model/base.rb, line 15
def to_a
  @raw_data.values
end

Private Instance Methods

method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/quandl/model/base.rb, line 25
def method_missing(method_name, *args, &block)
  return @raw_data[method_name.to_s] if @raw_data.key?(method_name.to_s)
  return @raw_data.method(method_name.to_s).call(*args, &block) if @raw_data.respond_to?(method_name.to_s)

  super
end