Sha256: 3740ef8b4d157b7ab13e9293f0783fb3b8f4cbda2bcb09dbe4cd93fc7a2f8445

Contents?: true

Size: 477 Bytes

Versions: 15

Compression:

Stored size: 477 Bytes

Contents

# encoding: UTF-8
module Kafo
  module StringHelper
    def dashize(string)
      string.tr('_', '-')
    end

    alias :d :dashize

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

    alias :u :underscore

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

    def parametrize(param, prefix = '')
      "--#{prefix}#{with_prefix(param)}"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kafo-7.6.0 lib/kafo/string_helper.rb
kafo-7.5.1 lib/kafo/string_helper.rb
kafo-7.5.0 lib/kafo/string_helper.rb
kafo-7.4.0 lib/kafo/string_helper.rb
kafo-7.3.0 lib/kafo/string_helper.rb
kafo-7.2.0 lib/kafo/string_helper.rb
kafo-7.1.0 lib/kafo/string_helper.rb
kafo-7.0.0 lib/kafo/string_helper.rb
kafo-6.5.0 lib/kafo/string_helper.rb
kafo-6.4.1 lib/kafo/string_helper.rb
kafo-6.4.0 lib/kafo/string_helper.rb
kafo-6.3.0 lib/kafo/string_helper.rb
kafo-6.2.1 lib/kafo/string_helper.rb
kafo-6.2.0 lib/kafo/string_helper.rb
kafo-6.1.2 lib/kafo/string_helper.rb