Class: Hprose::Client::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/hprose/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, namespace = nil) ⇒ Proxy

Returns a new instance of Proxy.



182
183
184
185
# File 'lib/hprose/client.rb', line 182

def initialize(client, namespace = nil)
  @client = client
  @namespace = namespace
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



189
190
191
192
# File 'lib/hprose/client.rb', line 189

def method_missing(methodname, *args, &block)
  methodname = @namespace.to_s + '_' + methodname.to_s unless @namespace.nil?
  @client.invoke(methodname, args, &block)
end

Instance Method Details

#[](namespace) ⇒ Object



186
187
188
# File 'lib/hprose/client.rb', line 186

def [](namespace)
  Proxy.new(@client, @namespace.to_s + '_' + namespace.to_s)
end