Class: EndecaOnDemand::Proxy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

Default behavior of method missing should be to delegate all calls to the target of the proxy. This can be overridden in special cases.

Parameters:

  • name (String, Symbol)

    The name of the method.

  • *args (Array)

    The arguments passed to the method.



34
35
36
# File 'lib/endeca_on_demand/proxy.rb', line 34

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

Instance Attribute Details

#xmlObject

Returns the value of attribute xml.



10
11
12
# File 'lib/endeca_on_demand/proxy.rb', line 10

def xml
  @xml
end

Instance Method Details

#inspectObject

:nodoc:



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

def inspect # :nodoc:
  return super if not respond_to?(:inspect_attributes) or inspect_attributes.blank?
  attributes = inspect_attributes.reject { |x|
    begin
      attribute = send x
      attribute.blank?
    rescue NoMethodError
      true
    end
  }.map { |attribute|
    "#{attribute.to_s.sub(/_\w+/, 's')}=#{send(attribute).inspect}"
  }.join ' '
  "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
end