Sha256: d05764c70166c5dccc80619699d50229f2d4177dbb00f3bdac2e58dc4b91310c

Contents?: true

Size: 627 Bytes

Versions: 16

Compression:

Stored size: 627 Bytes

Contents

module Eancom
  module Edifact
    class Composite
      class DataTypeError < StandardError; end

      attr_reader :data

      def initialize
        @data = {}
      end

      def add(key, value)
        if value.kind_of?(Data)
          @data[key] = value
        else
          raise DataTypeError.new('Added value is not of type Data.')
        end
      end

      def get(key)
        @data[key]
      end

      def delete(key)
        @data.delete(key)
      end

      def to_array
        array = []
        @data.each do |key, value|
          array << key
        end
        array
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
eancom-1.6.3 lib/eancom/edifact/composite.rb
eancom-1.6.2 lib/eancom/edifact/composite.rb
eancom-1.6.0 lib/eancom/edifact/composite.rb
eancom-1.5.7 lib/eancom/edifact/composite.rb
eancom-1.5.6 lib/eancom/edifact/composite.rb
eancom-1.5.5 lib/eancom/edifact/composite.rb
eancom-1.5.4 lib/eancom/edifact/composite.rb
eancom-1.5.2 lib/eancom/edifact/composite.rb
eancom-1.5.1 lib/eancom/edifact/composite.rb
eancom-1.5.0 lib/eancom/edifact/composite.rb
eancom-1.4.0 lib/eancom/edifact/composite.rb
eancom-1.3.0 lib/eancom/edifact/composite.rb
eancom-1.2.0 lib/eancom/edifact/composite.rb
eancom-1.1.1 lib/eancom/edifact/composite.rb
eancom-1.1.0 lib/eancom/edifact/composite.rb
eancom-2.0.0 lib/eancom/edifact/composite.rb