lib/mcoin/subscriber.rb in mcoin-0.5.0 vs lib/mcoin/subscriber.rb in mcoin-0.5.1
- old
+ new
@@ -2,18 +2,18 @@
module Mcoin
class Subscriber
attr_reader :markets, :pairs
- def initialize(pairs = [], market = Market.available)
+ def initialize(pairs = [], markets = Market.available)
@pairs = pairs_from(pairs)
- @markets = markets_from(market)
+ @markets = markets
end
def start(interval = 1, &block)
loop do
- Parallel.async(markets, :fetch) do |result|
+ Parallel.async(markets_from(markets), :fetch) do |result|
yield result.to_ticker
end
sleep interval
end
end
@@ -25,10 +25,10 @@
pair.split('-').map(&:to_sym)
end
end
def markets_from(picked)
- @markets ||= picked.map do |name|
+ picked.map do |name|
pairs.map do |pair|
Market
.pick(name)
.new(*pair)
end