Class: HQMF::TemporalReference
- Inherits:
-
Object
- Object
- HQMF::TemporalReference
- Includes:
- Conversion::Utilities
- Defined in:
- lib/hqmf-model/types.rb
Constant Summary collapse
- TYPES =
['DURING','SBS','SAS','SBE','SAE','EBS','EAS','EBE','EAE','SDU','EDU','ECW','SCW','CONCURRENT']
- INVERSION =
{'SBS' => 'SAS','EAE' => 'EBE','SAS' => 'SBS','EBE' => 'EAE','SBE' => 'EAS','EAS' => 'SBE','SAE' => 'EBS','EBS' => 'SAE'}
Instance Attribute Summary collapse
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(type, reference, range) ⇒ TemporalReference
constructor
A new instance of TemporalReference.
- #to_json ⇒ Object
Methods included from Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(type, reference, range) ⇒ TemporalReference
Returns a new instance of TemporalReference.
224 225 226 227 228 229 230 231 232 |
# File 'lib/hqmf-model/types.rb', line 224 def initialize(type, reference, range) @type = type @reference = reference if (range.is_a? HQMF::Value) @range = HQMF::Range.new('IVL_PQ', range, range, nil) else @range = range end end |
Instance Attribute Details
#range ⇒ Object (readonly)
Returns the value of attribute range.
219 220 221 |
# File 'lib/hqmf-model/types.rb', line 219 def range @range end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
219 220 221 |
# File 'lib/hqmf-model/types.rb', line 219 def reference @reference end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
219 220 221 |
# File 'lib/hqmf-model/types.rb', line 219 def type @type end |
Class Method Details
.from_json(json) ⇒ Object
234 235 236 237 238 239 240 |
# File 'lib/hqmf-model/types.rb', line 234 def self.from_json(json) type = json["type"] if json["type"] reference = HQMF::Reference.new(json["reference"]) if json["reference"] range = HQMF::Range.from_json(json["range"]) if json["range"] HQMF::TemporalReference.new(type,reference,range) end |
Instance Method Details
#==(other) ⇒ Object
251 252 253 |
# File 'lib/hqmf-model/types.rb', line 251 def ==(other) check_equality(self,other) end |
#to_json ⇒ Object
243 244 245 246 247 248 249 |
# File 'lib/hqmf-model/types.rb', line 243 def to_json x = nil json = build_hash(self, [:type]) json[:reference] = @reference.to_json if @reference json[:range] = @range.to_json if @range json end |