Class: GwtRpc::Procedure
- Inherits:
-
Object
- Object
- GwtRpc::Procedure
- Defined in:
- lib/gwt_rpc/procedure.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #call(client, *parameters) ⇒ Object
-
#initialize(options, &block) ⇒ Procedure
constructor
A new instance of Procedure.
- #request(client, *parameters) ⇒ Object
Constructor Details
#initialize(options, &block) ⇒ Procedure
Returns a new instance of Procedure.
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/gwt_rpc/procedure.rb', line 3 def initialize(, &block) .symbolize_keys! @path = [:path] or raise ":path must be provided" if block @block = block else @namespace = [:namespace] or raise ":namespace must be provided" @method = [:method] or raise ":method must be provided" @identifier = [:identifier] or raise ":identifier must be provided" end end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
2 3 4 |
# File 'lib/gwt_rpc/procedure.rb', line 2 def identifier @identifier end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
2 3 4 |
# File 'lib/gwt_rpc/procedure.rb', line 2 def method @method end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
2 3 4 |
# File 'lib/gwt_rpc/procedure.rb', line 2 def namespace @namespace end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
2 3 4 |
# File 'lib/gwt_rpc/procedure.rb', line 2 def path @path end |
Instance Method Details
#call(client, *parameters) ⇒ Object
15 16 17 |
# File 'lib/gwt_rpc/procedure.rb', line 15 def call(client, *parameters) response = request(client, *parameters).call end |
#request(client, *parameters) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/gwt_rpc/procedure.rb', line 19 def request(client, *parameters) if @block GwtRpc::Request.new(client, :procedure => self, :body => @block.call(*parameters)) else GwtRpc::Request.new(client, :procedure => self, :parameters => parameters) end end |