Replace a ternary with a simpler construct
authorWincent Colaiuta <win@wincent.com>
Sat, 28 Aug 2010 20:38:40 +0000 (22:38 +0200)
committerWincent Colaiuta <win@wincent.com>
Sat, 28 Aug 2010 20:38:40 +0000 (22:38 +0200)
Signed-off-by: Wincent Colaiuta <win@wincent.com>
lib/walrat/grammar.rb

index 7b996f88b2e3bf3cd5a28da5983e13999e01ce90..4be519d6642f3737e71f97530ec15cf2551496a0 100755 (executable)
@@ -202,7 +202,7 @@ module Walrat
           productions.has_key?(rule_name)
         raise ArgumentError, "non-existent rule '#{rule_name}'" unless
           rules.has_key?(rule_name)
-        results = results.empty? ? [:lexeme] : results
+        results = [:lexeme] if results.empty?
         const_get(rule_name.to_s.to_class_name).production *results
         productions[rule_name] = results
       end