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-1.0.3 lib/kafo/string_helper.rb
kafo-0.9.7 lib/kafo/string_helper.rb
kafo-1.0.2 lib/kafo/string_helper.rb
kafo-1.0.1 lib/kafo/string_helper.rb
kafo-1.0.0 lib/kafo/string_helper.rb
kafo-0.9.6 lib/kafo/string_helper.rb
kafo-0.9.5 lib/kafo/string_helper.rb
kafo-0.9.4 lib/kafo/string_helper.rb
kafo-0.9.3 lib/kafo/string_helper.rb
kafo-0.9.2 lib/kafo/string_helper.rb
kafo-0.9.1 lib/kafo/string_helper.rb
kafo-0.9.0 lib/kafo/string_helper.rb
kafo-0.8.2 lib/kafo/string_helper.rb