lib/mws/orders/entity.rb in mws-orders-0.2.1 vs lib/mws/orders/entity.rb in mws-orders-0.2.2
- old
+ new
@@ -1,10 +1,10 @@
-require "cgi"
-require "time"
-require "money"
-require "structure"
-require "mws/orders/document"
+require 'cgi'
+require 'time'
+require 'money'
+require 'structure'
+require 'mws/orders/document'
module MWS
module Orders
class Entity < Document
include Structure
@@ -18,13 +18,14 @@
text = text_at_xpath(path)
text.to_i if text
end
def money_at_xpath(path)
- return unless amount = float_at_xpath("#{path}/Amount")
+ amount = float_at_xpath("#{path}/Amount")
+ return unless amount
currency_code = text_at_xpath("#{path}/CurrencyCode")
- amount = amount * 100 unless currency_code == "JPY"
+ amount *= 100 unless currency_code == 'JPY'
Money.new(amount, currency_code)
end
def time_at_xpath(path)