Class: HQMF::Identifier

Inherits:
Object
  • Object
show all
Includes:
Conversion::Utilities
Defined in:
lib/hqmf-model/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Conversion::Utilities

#build_hash, #check_equality, #json_array, #openstruct_to_json

Constructor Details

#initialize(type, root, extension = nil) ⇒ Identifier

Returns a new instance of Identifier.



359
360
361
362
363
# File 'lib/hqmf-model/types.rb', line 359

def initialize(type, root, extension=nil)
  @type = type || 'II'
  @root = root
  @extension = extension
end

Instance Attribute Details

#extensionObject

Returns the value of attribute extension.



357
358
359
# File 'lib/hqmf-model/types.rb', line 357

def extension
  @extension
end

#rootObject

Returns the value of attribute root.



357
358
359
# File 'lib/hqmf-model/types.rb', line 357

def root
  @root
end

#typeObject

Returns the value of attribute type.



357
358
359
# File 'lib/hqmf-model/types.rb', line 357

def type
  @type
end

Class Method Details

.from_json(json) ⇒ Object



365
366
367
368
# File 'lib/hqmf-model/types.rb', line 365

def self.from_json(json)
  json = json.with_indifferent_access
  HQMF::Identifier.new(json['type'], json['root'], json['extension'])
end

Instance Method Details

#==(other) ⇒ Object



374
375
376
# File 'lib/hqmf-model/types.rb', line 374

def ==(other)
  check_equality(self,other)
end

#to_jsonObject



370
371
372
# File 'lib/hqmf-model/types.rb', line 370

def to_json
  build_hash(self, [:type, :root, :extension])
end