Class: GetFx::Parser

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

Instance Method Summary collapse

Constructor Details

#initialize(curr, time) ⇒ Parser



11
12
13
14
15
# File 'lib/getFx.rb', line 11

def initialize(curr, time)
  @curr = curr
  @date = time
  @doc = File.open("feed.xml") { |f| Nokogiri::XML(f) }
end

Instance Method Details

#runObject



17
18
19
20
# File 'lib/getFx.rb', line 17

def run
  puts 'fetching ' + @curr + ' on ' + @date
  r = @doc.css("[@time='" + @date + "'] > [@currency='" + @curr + "']")[0]["rate"]
end