Sha256: 5e53b4b538b7f42fe0f6265b3077842716d3db7710d9d23ef4fe16d41654eb2e

Contents?: true

Size: 475 Bytes

Versions: 33

Compression:

Stored size: 475 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

33 entries across 33 versions & 1 rubygems

Version Path
kafo-6.1.1 lib/kafo/string_helper.rb
kafo-6.1.0 lib/kafo/string_helper.rb
kafo-6.0.0 lib/kafo/string_helper.rb
kafo-5.1.0 lib/kafo/string_helper.rb
kafo-5.0.1 lib/kafo/string_helper.rb
kafo-5.0.0 lib/kafo/string_helper.rb
kafo-4.1.0 lib/kafo/string_helper.rb
kafo-4.0.1 lib/kafo/string_helper.rb
kafo-4.0.0 lib/kafo/string_helper.rb
kafo-3.0.0 lib/kafo/string_helper.rb
kafo-2.1.0 lib/kafo/string_helper.rb
kafo-2.0.2 lib/kafo/string_helper.rb
kafo-2.0.1 lib/kafo/string_helper.rb
kafo-2.0.0 lib/kafo/string_helper.rb
kafo-1.0.8 lib/kafo/string_helper.rb
kafo-1.0.7 lib/kafo/string_helper.rb
kafo-1.0.6 lib/kafo/string_helper.rb
kafo-1.0.5 lib/kafo/string_helper.rb
kafo-1.0.4 lib/kafo/string_helper.rb
kafo-0.9.8 lib/kafo/string_helper.rb