Class: Arbre::Element::Proxy

Inherits:
BasicObject
Defined in:
lib/arbre/element/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ Proxy

Returns a new instance of Proxy.



8
9
10
# File 'lib/arbre/element/proxy.rb', line 8

def initialize(element)
  @element = element
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/arbre/element/proxy.rb', line 20

def method_missing(method, *args, &block)
  if method.to_s == 'to_ary'
    super
  else
    @element.__send__ method, *args, &block
  end
end

Instance Method Details

#respond_to?(method, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
# File 'lib/arbre/element/proxy.rb', line 12

def respond_to?(method, include_all = false)
  if method.to_s == 'to_ary'
    false
  else
    super || @element.respond_to?(method, include_all)
  end
end