module NumRu::Units::Kakezan

Public Instance Methods

factor() click to toggle source
# File lib/numru/units.rb, line 2518
def factor
    f = 1
    for c in @children
        f *= c.factor
    end
    f
end
flatten2() click to toggle source
# File lib/numru/units.rb, line 2486
def flatten2
    r = MultiNode.new()
    each do |child|
        case child
        when MultiNode
            r.append child
        when MulNode
            r.append child.flatten2
        when ContainerNode
            r.append child.flatten2
        else
            r.append child
        end 
    end
    r
end
name() click to toggle source
# File lib/numru/units.rb, line 2503
def name
    n = nil
    for c in @children
        next if NumberNode === c
        na = c.name
        if n.nil?
            n = na
        else
            raise "multiple names found" if na != n
        end
    end
    n = "1" if n.nil?
    n
end