Module: Kafo::StringHelper
- Included in:
- HelpBuilders::Base, KafoConfigure
- Defined in:
- lib/kafo/string_helper.rb
Instance Method Summary collapse
- #dashize(string) ⇒ Object (also: #d)
- #parametrize(param, prefix = '') ⇒ Object
- #underscore(string) ⇒ Object (also: #u)
- #with_prefix(param) ⇒ Object
Instance Method Details
#dashize(string) ⇒ Object Also known as: d
4 5 6 |
# File 'lib/kafo/string_helper.rb', line 4 def dashize(string) string.tr('_', '-') end |
#parametrize(param, prefix = '') ⇒ Object
21 22 23 |
# File 'lib/kafo/string_helper.rb', line 21 def parametrize(param, prefix='') "--#{prefix}#{with_prefix(param)}" end |
#underscore(string) ⇒ Object Also known as: u
10 11 12 |
# File 'lib/kafo/string_helper.rb', line 10 def underscore(string) string.tr('-', '_') end |
#with_prefix(param) ⇒ Object
16 17 18 19 |
# File 'lib/kafo/string_helper.rb', line 16 def with_prefix(param) prefix = KafoConfigure.config.app[:no_prefix] ? '' : "#{d(param.module_name)}-" "#{prefix}#{d(param.name)}" end |