Class: GetFx::Parser
- Inherits:
-
Object
- Object
- GetFx::Parser
- Defined in:
- lib/getFx.rb
Instance Method Summary collapse
-
#initialize(curr, time) ⇒ Parser
constructor
A new instance of Parser.
- #run ⇒ Object
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
#run ⇒ Object
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 |