Class: GetFx::Parser
- Inherits:
-
Object
- Object
- GetFx::Parser
- Defined in:
- lib/getFx.rb
Instance Method Summary collapse
-
#initialize(curr, date, amt) ⇒ Parser
constructor
A new instance of Parser.
- #runCompute ⇒ Object
Constructor Details
#initialize(curr, date, amt) ⇒ Parser
Returns a new instance of Parser.
82 83 84 85 86 87 |
# File 'lib/getFx.rb', line 82 def initialize(curr, date, amt) @doc = File.open("feed.xml") { |f| Nokogiri::XML(f) } @curr = curr @date = date @amt = amt.to_f end |
Instance Method Details
#runCompute ⇒ Object
89 90 91 92 93 |
# File 'lib/getFx.rb', line 89 def runCompute r = @doc.css("[@time='" + @date + "'] > [@currency='" + @curr + "']")[0]["rate"] i = r.to_f return i * @amt end |