Class: RailsTwirp::Metal
- Inherits:
-
AbstractController::Base
- Object
- AbstractController::Base
- RailsTwirp::Metal
- Defined in:
- lib/rails_twirp/metal.rb
Overview
This is a simplest possible controller, providing a valid Rack interfacee without the additional niceties provided by RailsTwirp.
Idiologially, it’s similar to Rails version of ActionController::Metal
Direct Known Subclasses
Class Method Summary collapse
-
.controller_name ⇒ Object
Returns the last part of the controller’s name, underscored, without the ending
Controller
.
Instance Method Summary collapse
-
#controller_name ⇒ Object
Delegates to the class’s ::controller_name.
Class Method Details
.controller_name ⇒ Object
Returns the last part of the controller’s name, underscored, without the ending Controller
. For instance, PostsController returns posts
. Namespaces are left out, so Admin::PostsController returns posts
as well.
Returns
-
string
17 18 19 |
# File 'lib/rails_twirp/metal.rb', line 17 def self.controller_name @controller_name ||= (name.demodulize.delete_suffix("Controller").underscore unless anonymous?) end |
Instance Method Details
#controller_name ⇒ Object
Delegates to the class’s ::controller_name.
22 23 24 |
# File 'lib/rails_twirp/metal.rb', line 22 def controller_name self.class.controller_name end |