Class: Stargate::Server::Caller
- Inherits:
-
Object
- Object
- Stargate::Server::Caller
- Includes:
- Gallus::Logging, Marshal
- Defined in:
- lib/stargate/server/caller.rb
Overview
Internal: We need a way to call registered stuff. This little service handles it. Caller is defined per registry version and operates only within its context.
Instance Method Summary collapse
- #call(klass_name, method, *args) ⇒ Object
-
#initialize(registry_version) ⇒ Caller
constructor
A new instance of Caller.
Constructor Details
permalink #initialize(registry_version) ⇒ Caller
Returns a new instance of Caller.
9 10 11 12 |
# File 'lib/stargate/server/caller.rb', line 9 def initialize(registry_version) @marshaller = Marshaller.new(registry_version) @registry_version = registry_version end |
Instance Method Details
permalink #call(klass_name, method, *args) ⇒ Object
[View source]
14 15 16 17 18 19 20 |
# File 'lib/stargate/server/caller.rb', line 14 def call(klass_name, method, *args) method, = method.to_sym, @registry_version[klass_name] .class_methods.include?(method) or raise MethodNotExposedError, "Method not exposed: #{klass_name}.#{method}" result = .klass.send(method, *args) log.debug("Method call performed", class: klass_name, method: method, result:result.inspect) @marshaller.marshal(result) end |