Use define_method instead of class_eval

This commit is contained in:
Jo Liss 2012-09-09 23:36:45 +02:00
parent 722da33114
commit 26f6c783a7
2 changed files with 7 additions and 11 deletions

View File

@ -47,11 +47,9 @@ module Capybara
end
Session::DSL_METHODS.each do |method|
class_eval <<-RUBY, __FILE__, __LINE__+1
def #{method}(*args, &block)
page.#{method}(*args, &block)
end
RUBY
define_method method do |*args, &block|
page.send method, *args, &block
end
end
end

View File

@ -338,12 +338,10 @@ module Capybara
end
NODE_METHODS.each do |method|
class_eval <<-RUBY, __FILE__, __LINE__+1
def #{method}(*args, &block)
@touched = true
current_node.send(:#{method}, *args, &block)
end
RUBY
define_method method do |*args, &block|
@touched = true
current_node.send(method, *args, &block)
end
end
def inspect