Class: RailsTwirp::Metal

Inherits:
AbstractController::Base
  • Object
show all
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

Base

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.controller_nameObject

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_nameObject

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