Class: SimpleXml::SubsetOperator

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

Constant Summary

Constants included from Utilities

Utilities::MEASURE_ATTRIBUTES_MAP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#attr_val, attr_val, build_value, #children_of, #comments_on, #create_age_timing, #create_birthdate_criteria

Constructor Details

#initialize(type, value = nil) ⇒ SubsetOperator

Returns a new instance of SubsetOperator.



137
138
139
140
# File 'lib/model/types.rb', line 137

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

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



135
136
137
# File 'lib/model/types.rb', line 135

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



135
136
137
# File 'lib/model/types.rb', line 135

def value
  @value
end

Instance Method Details

#to_modelObject



149
150
151
152
# File 'lib/model/types.rb', line 149

def to_model
  vm = value ? value.to_model : nil
  HQMF::SubsetOperator.new(type, vm)
end

#translate_type(type) ⇒ Object



142
143
144
145
146
147
# File 'lib/model/types.rb', line 142

def translate_type(type)
  type = 'RECENT' if type == 'MOST RECENT'
  type = 'MEAN' if type == 'AVG'
  raise "unknown subset operator type #{type}" unless HQMF::SubsetOperator::TYPES.include? type
  type
end