Sha256: ae7bbc0588b9e7c9cd39ab47ad163c50b854734aa3ccb3a18fb1a13973993ccf

Contents?: true

Size: 948 Bytes

Versions: 5

Compression:

Stored size: 948 Bytes

Contents

require 'money_s3/builders/base_builder'
require 'money_s3/builders/header_kusovnik_type'
require 'money_s3/builders/child_kusovnik_type'
require 'money_s3/builders/komponenta_kusovnik_type'

module MoneyS3
  module Builders
    class KusovnikType
      include BaseBuilder

      def builder
        root = Ox::Element.new(name)
        if data.respond_to? :attributes
          data.attributes.each { |k, v| root[k] = v }
        end

        if data.key? :header
          root << HeaderKusovnikType.new('Header', data[:header]).builder
        end

        if data.key? :child
          root << ChildKusovnikType.new('Child', data[:child]).builder
        end

        if data.key? :seznam_komponent
          element = Ox::Element.new('SeznamKomponent')
          data[:seznam_komponent].each { |i| element << KomponentaKusovnikType.new('Komponenta', i).builder }
          root << element
        end

        root
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
money_s3-0.10.0 lib/money_s3/builders/kusovnik_type.rb
money_s3-0.9.0 lib/money_s3/builders/kusovnik_type.rb
money_s3-0.8.0 lib/money_s3/builders/kusovnik_type.rb
money_s3-0.7.0 lib/money_s3/builders/kusovnik_type.rb
money_s3-0.6.0 lib/money_s3/builders/kusovnik_type.rb