Module: Bankscrap::Openbank::Utils
Instance Method Summary collapse
Instance Method Details
#money(data, xpath) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/bankscrap/openbank/utils.rb', line 9 def money(data, xpath) Money.new( value_at_xpath(data, xpath + '/IMPORTE').delete('.'), value_at_xpath(data, xpath + '/DIVISA') ) end |
#value_at_xpath(node, xpath, default = '') ⇒ Object
4 5 6 7 |
# File 'lib/bankscrap/openbank/utils.rb', line 4 def value_at_xpath(node, xpath, default = '') value = node.at_xpath(xpath) value ? value.content.strip : default end |