lib/unitwise/expression/decomposer.rb in unitwise-0.10.0 vs lib/unitwise/expression/decomposer.rb in unitwise-1.0.0

- old
+ new

@@ -1,7 +1,10 @@ module Unitwise module Expression + # The decomposer is used to turn string expressions into collections of + # terms. It is responsible for executing the parsing and transformation + # of a string, as well as caching the results. class Decomposer MODES = [:primary_code, :secondary_code, :names, :slugs, :symbol] PARSERS = MODES.reduce({}) do |hash, mode| @@ -18,11 +21,11 @@ fail ExpressionError, "Could not evaluate '#{@expression}'." end end def parse - @parse ||= PARSERS.reduce(nil) do |null,(mode, parser)| + @parse ||= PARSERS.reduce(nil) do |_, (mode, parser)| parsed = parser.parse(expression) rescue next @mode = mode break parsed end end @@ -36,9 +39,9 @@ transform.terms else Array(transform) end end - + end end -end \ No newline at end of file +end