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



383
384
385
386
# File 'lib/hqmf-model/types.rb', line 383

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

Instance Attribute Details

#typeObject

Returns the value of attribute type.



381
382
383
# File 'lib/hqmf-model/types.rb', line 381

def type
  @type
end

#valueObject

Returns the value of attribute value.



381
382
383
# File 'lib/hqmf-model/types.rb', line 381

def value
  @value
end

Class Method Details

.from_json(json) ⇒ Object



388
389
390
391
# File 'lib/hqmf-model/types.rb', line 388

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

Instance Method Details

#==(other) ⇒ Object



397
398
399
# File 'lib/hqmf-model/types.rb', line 397

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

#to_jsonObject



393
394
395
# File 'lib/hqmf-model/types.rb', line 393

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