Class: Yahoofx::Pair

Inherits:
Object
  • Object
show all
Defined in:
lib/yahoofx/pair.rb

Instance Method Summary collapse

Constructor Details

#initialize(first, second) ⇒ Pair

First and second currency code. The parameters could be “USD” and “EUR” for instance



6
7
8
9
10
# File 'lib/yahoofx/pair.rb', line 6

def initialize(first, second)
  @first, @second = first.to_s, second.to_s
  raise "Invalid currency code provided" unless valid_currency_code?(@first) && 
                                                valid_currency_code?(@second)  
end

Instance Method Details

#bidObject



12
13
14
15
# File 'lib/yahoofx/pair.rb', line 12

def bid
  request_feed.scan(bid_regexp).each { |results| return results.first.to_f }
  nil
end