Module: Sevgi::Function::String

Included in:
Sevgi::Function
Defined in:
lib/sevgi/function/string.rb

Overview

String helpers used by generated names and user-facing text.

Instance Method Summary collapse

Instance Method Details

#demodulize(path) ⇒ String

Returns the final constant name segment from a module path.

Parameters:

  • path (Object)

    module, class, or string-like path

Returns:



10
11
12
13
14
15
16
17
# File 'lib/sevgi/function/string.rb', line 10

def demodulize(path)
  path = path.to_s
  if (i = path.rindex("::"))
    path[(i + 2), path.length]
  else
    path
  end
end