mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Use define_method instead of class_eval
This commit is contained in:
parent
722da33114
commit
26f6c783a7
2 changed files with 7 additions and 11 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue