diff --git a/lib/synvert/core.rb b/lib/synvert/core.rb index ee767049..2d7b3261 100644 --- a/lib/synvert/core.rb +++ b/lib/synvert/core.rb @@ -77,4 +77,5 @@ module Synvert PARSER_PARSER = 'parser' SYNTAX_TREE_PARSER = 'syntax_tree' PRISM_PARSER = 'prism' + ALL_PARSERS = [PARSER_PARSER, SYNTAX_TREE_PARSER, PRISM_PARSER].freeze end diff --git a/lib/synvert/core/rewriter.rb b/lib/synvert/core/rewriter.rb index ef53b1b5..d364e463 100644 --- a/lib/synvert/core/rewriter.rb +++ b/lib/synvert/core/rewriter.rb @@ -201,7 +201,7 @@ def reset # @option strategy [String] 'allow_insert_at_same_position' def configure(options) @options = @options.merge(options) - if options[:parser] && ![Synvert::PARSER_PARSER, Synvert::SYNTAX_TREE_PARSER, Synvert::PRISM_PARSER].include?(options[:parser]) + if options[:parser] && !Synvert::ALL_PARSERS.include?(options[:parser]) raise Errors::ParserNotSupported.new("Parser #{options[:parser]} not supported") end end