class Pragma::Operation::Base

This is the base class all your operations should extend.

@author Alessandro Desantis

Public Class Methods

operation_name() click to toggle source

Returns the name of this operation.

For instance, if the operation is called API::V1::Post::Operation::Create, returns create.

@return [Symbol]

# 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