Class: Stix2::Identifier

Inherits:
Object
  • Object
show all
Defined in:
lib/stix2/identifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Identifier

Returns a new instance of Identifier.



3
4
5
6
# File 'lib/stix2/identifier.rb', line 3

def initialize(value)
  value.match(/.*--.*/) || raise("Invalid identifier: #{value}")
  @value = value
end

Instance Method Details

#pretty_print(pp) ⇒ Object



12
13
14
15
16
# File 'lib/stix2/identifier.rb', line 12

def pretty_print(pp)
  # :nocov:
  pp.text(@value.inspect)
  # :nocov
end

#to_sObject



8
9
10
# File 'lib/stix2/identifier.rb', line 8

def to_s
  @value
end