lib/money_s3/builders/cinnost.rb in money_s3-0.4.0 vs lib/money_s3/builders/cinnost.rb in money_s3-0.5.0
- old
+ new
@@ -3,17 +3,29 @@
module MoneyS3
module Builders
class Cinnost
include BaseBuilder
- attr_accessor :zkrat, :nazev, :pozn
-
def builder
root = Ox::Element.new(element_name)
- root << (Ox::Element.new('Zkrat') << zkrat) if zkrat
- root << (Ox::Element.new('Nazev') << nazev) if nazev
- root << (Ox::Element.new('Pozn') << pozn) if pozn
+ if attributes.key? :zkrat
+ element = Ox::Element.new('Zkrat')
+ element << attributes[:zkrat] if attributes[:zkrat]
+ root << element
+ end
+
+ if attributes.key? :nazev
+ element = Ox::Element.new('Nazev')
+ element << attributes[:nazev] if attributes[:nazev]
+ root << element
+ end
+
+ if attributes.key? :pozn
+ element = Ox::Element.new('Pozn')
+ element << attributes[:pozn] if attributes[:pozn]
+ root << element
+ end
root
end
end
end
\ No newline at end of file