Class: SeleniumDSL::Proxy

Inherits:
PROXY_CLASS
  • Object
show all
Defined in:
lib/selenium_dsl/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(subject, methods_to_override = []) ⇒ Proxy

Returns a new instance of Proxy.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/selenium_dsl/proxy.rb', line 13

def initialize subject, methods_to_override=[]
  @subject = subject

  singleton_class = (class << self; self; end)

  # these methods are already defined in core classes: we need to override them
  methods_to_override.each do |method|
    singleton_class.send :define_method, method do |*args|
      @subject.send method, *args
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



28
29
30
# File 'lib/selenium_dsl/proxy.rb', line 28

def method_missing(name, *args, &block)
  @subject.send(name, *args, &block)
end