class Unitwise::Standard::DerivedUnit

Public Class Methods

local_key() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 8
def self.local_key
  "derived_unit"
end
remote_key() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 4
def self.remote_key
  "unit"
end

Public Instance Methods

arbitrary?() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 36
def arbitrary?
  attributes["@isArbitrary"] == 'yes'
end
classification() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 24
def classification
  attributes["@class"]
end
function() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 20
def function
  Function.new(attributes["value"]) if special?
end
metric?() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 28
def metric?
  attributes["@isMetric"] == 'yes'
end
property() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 12
def property
  attributes["property"].to_s
end
scale() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 16
def scale
  Scale.new(attributes["value"]) unless special?
end
special?() click to toggle source
# File lib/unitwise/standard/derived_unit.rb, line 32
def special?
  attributes["@isSpecial"] == 'yes'
end
to_hash() click to toggle source
Calls superclass method Unitwise::Standard::Base#to_hash
# File lib/unitwise/standard/derived_unit.rb, line 40
def to_hash
  hash = super()
  hash[:scale] = (special? ? function.to_hash : scale.to_hash)
  hash.merge({:classification => classification,
              :property => property, :metric => metric?,
              :special => special?, :arbitrary => arbitrary?})
end