lib/unitwise/expression/composer.rb in unitwise-0.3.0 vs lib/unitwise/expression/composer.rb in unitwise-0.3.1
- old
+ new
@@ -1,16 +1,10 @@
module Unitwise
module Expression
class Composer
attr_reader :terms
- def initialize(input)
- if input.respond_to?(:terms)
- @terms = input.terms
- elsif input.respond_to?(:each)
- @terms = input
- else
- @terms = Expression.decompose(input.to_s)
- end
+ def initialize(terms)
+ @terms = terms
end
def set
@set ||= terms.reduce(SignedMultiset.new) do |s, t|
s.increment({f: t.factor, p: t.prefix_code, a: t.atom_code}, t.exponent); s
\ No newline at end of file