Class: VirtualKeywords::ParserStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/virtual_keywords/parser_strategy.rb

Class Method Summary collapse

Class Method Details

.newObject

Factory method Create the appropriate strategy object for the current Ruby version.



5
6
7
8
9
10
11
# File 'lib/virtual_keywords/parser_strategy.rb', line 5

def self.new
  if RUBY_VERSION.start_with? '1.8'
    ParseTreeStrategy.new(ParseTree, SexpProcessor.new)
  else
    RubyParserStrategy.new(RubyParser.new)
  end
end