Class: CoinSync::Config::ValueEstimationOptions

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/coinsync/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ValueEstimationOptions

Returns a new instance of ValueEstimationOptions.



124
125
126
127
128
129
130
131
132
# File 'lib/coinsync/config.rb', line 124

def initialize(options)
  super

  if options['using']
    self.price_loader_name = options['using'].to_sym
  else
    raise "'value_estimation' requires a 'using' field with a name of a price loader"
  end
end

Instance Method Details

#price_loaderObject



134
135
136
137
138
139
140
141
142
# File 'lib/coinsync/config.rb', line 134

def price_loader
  price_loader_class = PriceLoaders.registered[price_loader_name]

  if price_loader_class
    price_loader_class.new(self)
  else
    raise "Unknown price loader: #{price_loader_name}"
  end
end