Class: HQMF::SubsetOperator

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

Constant Summary collapse

TYPES =
['COUNT', 'FIRST', 'SECOND', 'THIRD', 'FOURTH', 'FIFTH', 'RECENT', 'LAST', 'MIN', 'MAX', 'DATEDIFF', 'TIMEDIFF', 'MEDIAN', 'MEAN']

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) ⇒ SubsetOperator

Returns a new instance of SubsetOperator.

Parameters:

  • type (String)
  • value (Value)


265
266
267
268
269
270
271
272
273
# File 'lib/hqmf-model/types.rb', line 265

def initialize(type,value)
  @type = type
  if (value.is_a? HQMF::Value)
    value.inclusive = true
    @value = HQMF::Range.new('IVL_PQ',value,value,nil)
  else
    @value = value
  end
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



262
263
264
# File 'lib/hqmf-model/types.rb', line 262

def type
  @type
end

#valueObject

Returns the value of attribute value.



262
263
264
# File 'lib/hqmf-model/types.rb', line 262

def value
  @value
end

Class Method Details

.from_json(json) ⇒ Object



275
276
277
278
279
280
# File 'lib/hqmf-model/types.rb', line 275

def self.from_json(json)
  type = json["type"] if json["type"]
  value = HQMF::Range.from_json(json["value"]) if json["value"]
  
  HQMF::SubsetOperator.new(type,value)
end

Instance Method Details

#==(other) ⇒ Object



290
291
292
# File 'lib/hqmf-model/types.rb', line 290

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

#to_jsonObject



283
284
285
286
287
288
# File 'lib/hqmf-model/types.rb', line 283

def to_json
  x = nil
  json = build_hash(self, [:type])
  json[:value] = @value.to_json if @value
  json
end