Module: Spiker

Defined in:
lib/spiker.rb,
lib/spiker/cli.rb,
lib/spiker/version.rb,
lib/spiker/generators/given.rb,
lib/spiker/generators/multi.rb,
lib/spiker/generators/simple.rb

Overview

Spiker is a simple spike generator.

Defined Under Namespace

Modules: Generators Classes: CLI, Error

Constant Summary collapse

VERSION =
"0.1.6"

Class Method Summary collapse

Class Method Details

.classify(str) ⇒ Object



9
10
11
# File 'lib/spiker.rb', line 9

def self.classify(str)
  str.split(/[^A-Za-z0-0]/).map(&:capitalize).join
end

.snake_case(str) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/spiker.rb', line 13

def self.snake_case(str)
  # lifted from ActiveSupport inflectors
  str.gsub("::", "/")
     .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
     .gsub(/([a-z\d])([A-Z])/, '\1_\2')
     .tr("-", "_")
     .downcase
end