Sha256: 5e1f02d7eae7a2e6045b07209d02f178cb4e7ec9991fa74930f5e5c53ffabc7c

Contents?: true

Size: 316 Bytes

Versions: 22

Compression:

Stored size: 316 Bytes

Contents

# -*- encoding: utf-8 -*-

module PMP
  module Utils

    def to_ruby_safe_name(name)
      safe = name.to_s.strip
      safe = safe.gsub(/[^\w_!?=]+/, '_').sub(/^[0-9!?=]/, '')
      safe[0..-2].gsub(/[!?=]+/, '_') + safe[-1]
    end

    def to_json_key_name(name)
      name.to_s.gsub(/_/, '-')
    end

  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pmp-0.5.7 lib/pmp/utils.rb
pmp-0.5.6 lib/pmp/utils.rb
pmp-0.5.5 lib/pmp/utils.rb
pmp-0.5.4 lib/pmp/utils.rb
pmp-0.5.3 lib/pmp/utils.rb
pmp-0.5.2 lib/pmp/utils.rb
pmp-0.5.1 lib/pmp/utils.rb
pmp-0.5.0 lib/pmp/utils.rb
pmp-0.4.1 lib/pmp/utils.rb
pmp-0.4.0 lib/pmp/utils.rb
pmp-0.3.2 lib/pmp/utils.rb
pmp-0.3.1 lib/pmp/utils.rb
pmp-0.3.0 lib/pmp/utils.rb
pmp-0.2.4 lib/pmp/utils.rb
pmp-0.2.3 lib/pmp/utils.rb
pmp-0.2.2 lib/pmp/utils.rb
pmp-0.2.1 lib/pmp/utils.rb
pmp-0.2.0 lib/pmp/utils.rb
pmp-0.1.3 lib/pmp/utils.rb
pmp-0.1.2 lib/pmp/utils.rb