Module: BER

Includes:
Dry::Core::Constants
Defined in:
lib/ber.rb,
lib/ber/version.rb,
lib/ber/function.rb,
lib/ber/identified/oid.rb,
lib/ber/refinements/io.rb,
lib/ber/identified/null.rb,
lib/ber/identified/array.rb,
lib/ber/identified/string.rb,
lib/ber/refinements/array.rb,
lib/ber/refinements/string.rb,
lib/ber/refinements/integer.rb,
lib/ber/refinements/string_io.rb,
lib/ber/refinements/ssl_socket.rb,
lib/ber/refinements/true_class.rb,
lib/ber/refinements/false_class.rb

Overview

Refine FalseClass

Defined Under Namespace

Classes: BerIdentifiedArray, BerIdentifiedNull, BerIdentifiedOid, BerIdentifiedString, Function

Constant Summary collapse

Error =
Class.new(RuntimeError)
ASN_SYNTAX =
compile_syntax(config[:syntax]).freeze
IDENTIFIED =
compile_syntax(config[:identified_type]).freeze
MAX_FIXNUM_SIZE =
0.size
WILDCARD =
'*'
VERSION =
'0.1.0'
Null =
BerIdentifiedNull.new

Class Method Summary collapse

Class Method Details

.compile_syntax(syntax) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ber.rb', line 53

def self.compile_syntax(syntax)
  out = [nil] * 256

  syntax.each do |tag_class_id, encodings|
    tag_class = config[:tag_class][tag_class_id]
    encodings.each do |encoding_id, classes|
      encoding     = config[:encoding_type][encoding_id]
      object_class = tag_class + encoding
      classes.each do |number, object_type|
        out[object_class + number] = object_type
      end
    end
  end

  out
end

.configHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
# File 'lib/ber.rb', line 33

def self.config
  @config ||= YAML.load_file(root.join('ber.yaml')).freeze
end

.fetch(type, val) ⇒ Symbol, Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
49
50
51
# File 'lib/ber.rb', line 46

def self.fetch(type, val)
  case val
  when Integer then config[type][val]
  when Symbol  then config[type].key(val)
  end
end

.functionObject



15
16
17
# File 'lib/ber.rb', line 15

def self.function
  @function ||= Function.new
end

.rootPathname

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Path to gem root



24
25
26
# File 'lib/ber.rb', line 24

def self.root
  Pathname(File.dirname(__FILE__))
end