Sha256: 83b1358bf2e4210b9ea606215b0034c9981633c5e1eb87b00416be6d7d630bf8

Contents?: true

Size: 718 Bytes

Versions: 4

Compression:

Stored size: 718 Bytes

Contents

require 'parslet'

require 'unitwise/expression/matcher'
require 'unitwise/expression/parser'
require 'unitwise/expression/transformer'
require 'unitwise/expression/composer'
require 'unitwise/expression/decomposer'

module Unitwise
  module Expression
    class << self
      def compose(terms)
        Composer.new(terms).expression
      end

      def decompose(expression)
        expression = expression.to_s
        @decompose ||= {}
        if @decompose.has_key?(expression)
          @decompose[expression]
        else
          @decompose[expression] = begin
            Decomposer.new(expression).terms
          rescue ExpressionError
            nil
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unitwise-0.3.1 lib/unitwise/expression.rb
unitwise-0.3.0 lib/unitwise/expression.rb
unitwise-0.2.2 lib/unitwise/expression.rb
unitwise-0.2.1 lib/unitwise/expression.rb