Class: TwirpHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_respond_to_pb/twirp_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller:) ⇒ TwirpHandler

class UnknownRpcError < StandardError; end



6
7
8
# File 'lib/rails_respond_to_pb/twirp_handler.rb', line 6

def initialize(controller:)
  @controller = controller
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &_block) ⇒ Object



21
22
23
# File 'lib/rails_respond_to_pb/twirp_handler.rb', line 21

def method_missing(method_name, *arguments, &_block)
  dispatch method_name, arguments[0], arguments[1]
end

Instance Method Details

#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/rails_respond_to_pb/twirp_handler.rb', line 25

def respond_to_missing?(method_name, _include_private = false)
  @controller.method_defined? method_name
end