Class: HQMF::GenericValueContainer

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, value) ⇒ GenericValueContainer

Returns a new instance of GenericValueContainer.



409
410
411
412
# File 'lib/hqmf-model/types.rb', line 409

def initialize(type, value)
  @type = type
  @value = value
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



407
408
409
# File 'lib/hqmf-model/types.rb', line 407

def type
  @type
end

#valueObject

Returns the value of attribute value.



407
408
409
# File 'lib/hqmf-model/types.rb', line 407

def value
  @value
end

Class Method Details

.from_json(json) ⇒ Object



414
415
416
417
# File 'lib/hqmf-model/types.rb', line 414

def self.from_json(json)
  json = json.with_indifferent_access
  HQMF::GenericValueContainer.new(json['type'], json['value'])
end

Instance Method Details

#==(other) ⇒ Object



423
424
425
# File 'lib/hqmf-model/types.rb', line 423

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

#to_jsonObject



419
420
421
# File 'lib/hqmf-model/types.rb', line 419

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