Sha256: c415e0bcb04c7907cccccd1d02946aa953b153c1d9c96b922ad9fbdbecf861b1
Contents?: true
Size: 884 Bytes
Versions: 1
Compression:
Stored size: 884 Bytes
Contents
module Unitwise class Scale attr_reader :value include Unitwise::Composable def initialize(value, unit) @value = value if unit.is_a?(Unit) @unit = unit.dup else @unit = Unit.new(unit.to_s) end end def dup self.class.new(value, unit) end def atoms unit.atoms end def terms unit.terms end def special? unit.special? end def functional(x=value, forward=true) unit.functional(x, forward) end def scalar value * unit.scalar end def unit @unit ||= Unit.new(@unit_code) end def root_terms unit.root_terms end def depth unit.depth + 1 end def terminal? depth <= 3 end def to_s "#{value} #{unit}" end def inspect "<#{self.class} #{to_s}>" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unitwise-0.3.1 | lib/unitwise/scale.rb |