Module: Toolchest::Naming

Defined in:
lib/toolchest/naming.rb

Class Method Summary collapse

Class Method Details

.generate(toolbox_class, method_name, strategy = :underscored) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/toolchest/naming.rb', line 4

def generate(toolbox_class, method_name, strategy = :underscored)
  prefix = toolbox_prefix(toolbox_class)

  case strategy
  when :underscored
    "#{prefix}_#{method_name}"
  when :dotted
    "#{prefix}.#{method_name}"
  when :slashed
    "#{prefix}/#{method_name}"
  when Proc
    strategy.call(prefix, method_name.to_s)
  else
    "#{prefix}_#{method_name}"
  end
end