class Farcall::Interface
Interface
to the remote provider via Farcall
protocols. Works the same as the normal, local object, but slower. This interface is returned by {Farcall::Endpoint#remote}. The Interface
transparently creates methods as you call them to speed up subsequent calls.
There is no way to check that the remote responds to some method other than call it and catch the exception.
See {Farcall::RemoteError} for more information on passing errors.
Attributes
the {Farcall::Endpoint} to which this interface is connected.
Public Class Methods
Create interface connected to some endpoint ar transpost.
Please remember that Farcall::Transport
instance could be used with only one connected object, unlike the Farcall::Endpoint
, which could be connected to several consumers.
@param endpoint [Farcall::Endpoint] endpoint to connecto to. If not provided, then interface
will try to use _transport_ or create it using params.
@param transport [Farcall::Transport] transport what to use @param params [Hash] used to create transport when neither endpoint not transport present
# File lib/farcall/endpoint.rb, line 332 def initialize endpoint: nil, transport: nil, provider: nil, **params @endpoint = if endpoint endpoint else Farcall::Endpoint.new(transport || Farcall::Transport.create(**params)) end provider and @endpoint.provider = provider end
Public Instance Methods
used internally to synthesize the proxy method.
# File lib/farcall/endpoint.rb, line 345 def method_missing(method_name, *arguments, **kw_arguments, &block) instance_eval <<-End def #{method_name} *arguments, **kw_arguments @endpoint.sync_call '#{method_name}', *arguments, **kw_arguments end End @endpoint.sync_call method_name, *arguments, **kw_arguments end
used internally to synthesize the proxy method.
# File lib/farcall/endpoint.rb, line 355 def respond_to_missing?(method_name, include_private = false) true end