class Ticker

Public Class Methods

new(symbol) click to toggle source
# File vendor/qwik/lib/qwik/check-observer.rb, line 10
def initialize(symbol)
  @symbol = symbol
end

Public Instance Methods

run() click to toggle source
# File vendor/qwik/lib/qwik/check-observer.rb, line 14
def run
  lastPrice = nil
  loop {
    price = Price.fetch(@symbol)
    print "Current price: #{price}\n"
    if price != lastPrice
      changed                 # notify observers
      lastPrice = price
      notify_observers(Time.now, price)
    end
    sleep 1
  }
end