Method: LogicTools::NodeNary#flatten

Defined in:
lib/logic_tools/logictree.rb

#flattenObject

Flatten ands, ors and nots.



673
674
675
676
677
678
679
680
681
# File 'lib/logic_tools/logictree.rb', line 673

def flatten # :nodoc:
    return NodeNary.make(@op,*(@children.reduce([]) do |nchildren,child|
        if (child.op == self.op) then
            nchildren.push(*child)
        else
            nchildren << child
        end
    end)).reduce
end