Class: Twirp::Service
- Inherits:
-
Object
- Object
- Twirp::Service
- Defined in:
- lib/twirp/rails.rb,
lib/twirp/rails/engine.rb
Instance Method Summary collapse
-
#initialize(handler = nil) ⇒ Service
constructor
A new instance of Service.
-
#inspect ⇒ Object
Override inspect to show all available RPCs This is used when displaying routes.
-
#original_initialize ⇒ Object
Override initialize to make handler argument optional.
Constructor Details
#initialize(handler = nil) ⇒ Service
Returns a new instance of Service.
26 27 28 29 |
# File 'lib/twirp/rails.rb', line 26 def initialize(handler = nil) handler ||= Twirp::Rails::Dispatcher.new(self.class) original_initialize(handler) end |
Instance Method Details
#inspect ⇒ Object
Override inspect to show all available RPCs This is used when displaying routes.
61 62 63 |
# File 'lib/twirp/rails/engine.rb', line 61 def inspect self.class.rpcs.map { |rpc| "#{self.class.name.demodulize.underscore}_handler##{rpc[1][:ruby_method]}" }.join("\n") end |
#original_initialize ⇒ Object
Override initialize to make handler argument optional. When left nil, we will use our dispatcher.
25 |
# File 'lib/twirp/rails.rb', line 25 alias_method :original_initialize, :initialize |