Module: CurrencyUpdater
- Defined in:
- lib/currency_updater.rb,
lib/currency_updater/updater.rb,
lib/currency_updater/currency.rb,
lib/currency_updater/currencies.rb
Defined Under Namespace
Classes: Currencies, Currency, Updater
Constant Summary collapse
- @@rate_finder =
lambda {|currency| client = Net::HTTP.new("www.google.de") resp = client.get("/search?hl=de&q=1+EUR+to+#{currency}&btnG=Suche&meta=") text_only = resp.body.gsub(/<[^>]*>/, "") match = text_only.match(/1\s+Euro\s+=\s+([0-9\.\s]*)/mix) rate = if match match[1] else warn "currency #{currency} is unsupported" "1.00" end rate.gsub!(/\s+/, "").to_f }
Class Method Summary collapse
Class Method Details
.setup {|_self| ... } ⇒ Object
27 28 29 |
# File 'lib/currency_updater.rb', line 27 def self.setup yield self end |