class HQMF::Value

Represents a bound within a HQMF pauseQuantity, has a value, a unit and an inclusive/exclusive indicator

Attributes

expression[R]
inclusive[RW]
type[RW]
unit[R]
value[RW]

Public Class Methods

from_json(json) click to toggle source
# File lib/hqmf-model/types.rb, line 51
def self.from_json(json)
  type = json["type"] if json["type"]
  unit = json["unit"] if json["unit"]
  value = json["value"] if json["value"]
  inclusive = json["inclusive?"] unless json["inclusive?"].nil?
  derived = json["derived?"] unless json["derived?"].nil?
  expression = json["expression"] if json["expression"]
  
  HQMF::Value.new(type,unit,value,inclusive,derived,expression)
end
new(type,unit,value,inclusive,derived,expression) click to toggle source

Create a new HQMF::Value @param [String] type @param [String] unit @param [String] value @param [Boolean] inclusive @param [Boolean] derived @param [String] expression

# File lib/hqmf-model/types.rb, line 42
def initialize(type,unit,value,inclusive,derived,expression)
  @type = type || 'PQ'
  @unit = unit
  @value = value
  @inclusive = inclusive == nil ? true : inclusive
  @derived = derived || false
  @expression = expression
end

Public Instance Methods

==(other) click to toggle source
# File lib/hqmf-model/types.rb, line 79
def ==(other)
  check_equality(self,other)
end
derived?() click to toggle source
# File lib/hqmf-model/types.rb, line 67
def derived?
  @derived
end
inclusive?() click to toggle source
# File lib/hqmf-model/types.rb, line 63
def inclusive?
  @inclusive
end
stringify() click to toggle source
# File lib/hqmf-model/types.rb, line 75
def stringify
  "#{inclusive? ? '=' : ''}#{value}#{unit ? ' '+unit : ''}"
end
to_json() click to toggle source
# File lib/hqmf-model/types.rb, line 71
def to_json
  build_hash(self, [:type,:unit,:value,:inclusive?,:derived?,:expression])
end