class Quandl::Strategy::Strategize

Attributes

attributes[RW]

Public Class Methods

call(attrs) click to toggle source
# File lib/quandl/strategy.rb, line 34
def self.call(attrs)
  self.new(attrs).attributes
end
define_attributes(*names) click to toggle source
# File lib/quandl/strategy.rb, line 44
def self.define_attributes(*names)
  names.each do |name|
    # getter
    define_method(name) do
      self.attributes[name.to_sym]
    end
    # setter
    define_method("#{name}=") do |value|
      self.attributes[name.to_sym] = value
    end
    # present?
    define_method("#{name}?") do
      self.attributes[name.to_sym].present?
    end
  end
end
new(attrs) click to toggle source
# File lib/quandl/strategy.rb, line 38
def initialize(attrs)
  attrs = attrs.clone if attrs.respond_to?(:clone)
  self.attributes = attrs
  self.perform if respond_to?(:perform)
end