Class: Hessian2::Client
- Inherits:
-
Object
- Object
- Hessian2::Client
- Defined in:
- lib/hessian2/client.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#proxy ⇒ Object
readonly
Returns the value of attribute proxy.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(url, options = {}) ⇒ Client
constructor
A new instance of Client.
- #method_missing(id, *args) ⇒ Object
Constructor Details
#initialize(url, options = {}) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hessian2/client.rb', line 9 def initialize(url, = {}) uri = URI.parse(url) @scheme, @host, @port, @path = uri.scheme, uri.host, uri.port, uri.path.empty? ? '/' : uri.path @path += "?#{uri.query}" if uri.query raise "Unsupported Hessian protocol: #{@scheme}" unless %w(http https).include?(@scheme) @async = .delete(:async) @fiber_aware = .delete(:fiber_aware) if @async || @fiber_aware begin require 'em-synchrony/em-http' rescue LoadError => error raise "Missing EM-Synchrony dependency: gem install em-synchrony em-http-request" end else require 'net/http' end @proxy = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args) ⇒ Object
29 30 31 |
# File 'lib/hessian2/client.rb', line 29 def method_missing(id, *args) return invoke(id.id2name, args) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/hessian2/client.rb', line 7 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/hessian2/client.rb', line 6 def password @password end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/hessian2/client.rb', line 7 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
7 8 9 |
# File 'lib/hessian2/client.rb', line 7 def port @port end |
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
7 8 9 |
# File 'lib/hessian2/client.rb', line 7 def proxy @proxy end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
7 8 9 |
# File 'lib/hessian2/client.rb', line 7 def scheme @scheme end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/hessian2/client.rb', line 6 def user @user end |