Class: Pragma::Operation::Base
- Inherits:
-
Trailblazer::Operation
- Object
- Trailblazer::Operation
- Pragma::Operation::Base
- Defined in:
- lib/pragma/operation/base.rb
Overview
This is the base class all your operations should extend.
Class Method Summary collapse
-
.operation_name ⇒ Symbol
Returns the name of this operation.
Class Method Details
.operation_name ⇒ Symbol
Returns the name of this operation.
For instance, if the operation is called API::V1::Post::Operation::Create
, returns create
.
16 17 18 19 20 21 22 23 |
# File 'lib/pragma/operation/base.rb', line 16 def operation_name name.split('::').last .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase .to_sym end |