Sha256: 7d21cf4fb0c502b848e0ee32912aaec2f191b2c488c58747c94ed6828d24a4a0

Contents?: true

Size: 841 Bytes

Versions: 2

Compression:

Stored size: 841 Bytes

Contents

# frozen_string_literal: true

module RASN1
  module Types
    # @abstract This class SHOULD be used as base class for all ASN.1 primitive
    #  types.
    # Base class for all ASN.1 constructed types
    # @author Sylvain Daubert
    class Constructed < Base
      # Constructed value
      ASN1_PC = 0x20

      def inspect(level=0)
        case @value
        when Array
          str = common_inspect(level)
          str << "\n"
          level = level.abs + 1
          @value.each do |item|
            case item
            when Base, Model
              next if item.optional? && item.value.nil?

              str << "#{item.inspect(level)}\n"
            else
              str << '  ' * level + item.inspect + "\n"
            end
          end
          str
        else
          super
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rasn1-0.7.1 lib/rasn1/types/constructed.rb
rasn1-0.7.0 lib/rasn1/types/constructed.rb