Class: RASN1::Model::Elem

Inherits:
Struct
  • Object
show all
Defined in:
lib/rasn1/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, proc_or_class, content) ⇒ Elem

Returns a new instance of Elem.

Parameters:

  • name (String, Symbol)
  • proc_or_class (Proc, Class)
  • content (Array, nil)


72
73
74
75
76
77
78
79
# File 'lib/rasn1/model.rb', line 72

def initialize(name, proc_or_class, content)
  if content.is_a?(Array)
    duplicate_names = find_all_duplicate_names(content.map(&:name) + [name])
    raise ModelValidationError, "Duplicate name #{duplicate_names.first} found" if duplicate_names.any?
  end

  super
end

Instance Attribute Details

#contentObject

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



68
69
70
# File 'lib/rasn1/model.rb', line 68

def content
  @content
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



68
69
70
# File 'lib/rasn1/model.rb', line 68

def name
  @name
end

#proc_or_classObject

Returns the value of attribute proc_or_class

Returns:

  • (Object)

    the current value of proc_or_class



68
69
70
# File 'lib/rasn1/model.rb', line 68

def proc_or_class
  @proc_or_class
end