Class: HQMF::SubsetOperator
- Inherits:
-
Object
- Object
- HQMF::SubsetOperator
- 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', 'DATETIMEDIFF', 'MEDIAN', 'MEAN', 'SUM']
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(type, value) ⇒ SubsetOperator
constructor
A new instance of SubsetOperator.
- #supports_grouper_criteria? ⇒ Boolean
- #to_json ⇒ Object
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.
271 272 273 274 275 276 277 278 279 |
# File 'lib/hqmf-model/types.rb', line 271 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
#type ⇒ Object
Returns the value of attribute type.
268 269 270 |
# File 'lib/hqmf-model/types.rb', line 268 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
268 269 270 |
# File 'lib/hqmf-model/types.rb', line 268 def value @value end |
Class Method Details
.from_json(json) ⇒ Object
285 286 287 288 289 |
# File 'lib/hqmf-model/types.rb', line 285 def self.from_json(json) type = json["type"] if json["type"] value = HQMF::DataCriteria.convert_value(json["value"]) if json["value"] HQMF::SubsetOperator.new(type,value) end |
Instance Method Details
#==(other) ⇒ Object
298 299 300 |
# File 'lib/hqmf-model/types.rb', line 298 def ==(other) check_equality(self,other) end |
#supports_grouper_criteria? ⇒ Boolean
281 282 283 |
# File 'lib/hqmf-model/types.rb', line 281 def supports_grouper_criteria? ['FIRST', 'SECOND', 'THIRD', 'FOURTH', 'FIFTH', 'RECENT', 'LAST'].include? @type end |
#to_json ⇒ Object
292 293 294 295 296 |
# File 'lib/hqmf-model/types.rb', line 292 def to_json json = build_hash(self, [:type]) json[:value] = @value.to_json if @value json end |