# File lib/method_source.rb, line 16 def self.valid_expression?(str) if defined?(Rubinius::Melbourne19) && RUBY_VERSION =~ /^1\.9/ Rubinius::Melbourne19.parse_string(str) elsif defined?(Rubinius::Melbourne) Rubinius::Melbourne.parse_string(str) else catch(:valid) { eval("BEGIN{throw :valid}\n#{str}") } end true rescue SyntaxError false end