Module: StringHelper

Included in:
KafoConfigure
Defined in:
lib/kafo/string_helper.rb

Instance Method Summary collapse

Instance Method Details

#dashize(string) ⇒ Object Also known as: d



3
4
5
# File 'lib/kafo/string_helper.rb', line 3

def dashize(string)
  string.tr('_', '-')
end

#parametrize(param) ⇒ Object



18
19
20
# File 'lib/kafo/string_helper.rb', line 18

def parametrize(param)
  "--#{with_prefix(param)}"
end

#underscore(string) ⇒ Object Also known as: u



8
9
10
# File 'lib/kafo/string_helper.rb', line 8

def underscore(string)
  string.tr('-', '_')
end

#with_prefix(param) ⇒ Object



13
14
15
16
# File 'lib/kafo/string_helper.rb', line 13

def with_prefix(param)
  prefix = KafoConfigure.config.app[:no_prefix] ? '' : "#{d(param.module_name)}-"
  "#{prefix}#{d(param.name)}"
end