Module: RawJsonRpc::RawServerJsonRpc
- Included in:
- JSONTCPServer
- Defined in:
- lib/rawjsonrpc/server.rb
Overview
Implements the basic server functions When implementing a new server type you must only give a jsonstring to the execute function.
Example
Add Functions
server.add_method(“run”, methode(:test)) #adds methode test as “run” server.add_block(“attack”){ |target, dir, times|
#stuff
}
Instance Method Summary collapse
-
#add_block(name, &block) ⇒ Object
Adds blocks that get executed Arguments can not checkt because they are procs no lambdas if you can provied a hack plz contribute.
-
#add_method(name, func) ⇒ Object
Adds methode to be executed.
Instance Method Details
#add_block(name, &block) ⇒ Object
Adds blocks that get executed Arguments can not checkt because they are procs no lambdas if you can provied a hack plz contribute.
36 37 38 39 40 |
# File 'lib/rawjsonrpc/server.rb', line 36 def add_block(name, &block) @rawjsonrpc_blocks ||= {} @rawjsonrpc_funcs ||= {} @rawjsonrpc_blocks[name] = block end |
#add_method(name, func) ⇒ Object
Adds methode to be executed
28 29 30 31 32 |
# File 'lib/rawjsonrpc/server.rb', line 28 def add_method(name, func) @rawjsonrpc_funcs ||= {} @rawjsonrpc_blocks ||= {} @rawjsonrpc_funcs[name] = func end |