lib/money_s3/builders/cinnost.rb in money_s3-0.5.0 vs lib/money_s3/builders/cinnost.rb in money_s3-0.6.0
- old
+ new
@@ -4,28 +4,17 @@
module Builders
class Cinnost
include BaseBuilder
def builder
- root = Ox::Element.new(element_name)
-
- if attributes.key? :zkrat
- element = Ox::Element.new('Zkrat')
- element << attributes[:zkrat] if attributes[:zkrat]
- root << element
+ root = Ox::Element.new(name)
+ if data.respond_to? :attributes
+ data.attributes.each { |k, v| root[k] = v }
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 << build_element('Zkrat', data[:zkrat]) if data.key? :zkrat
+ root << build_element('Nazev', data[:nazev]) if data.key? :nazev
+ root << build_element('Pozn', data[:pozn]) if data.key? :pozn
root
end
end
end
\ No newline at end of file