Sha256: facf205aa38a78d0d54cce7e5044ec767287e7428ef65ebd4234b27097e9a0cc

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

module Moneta
  module CoreExt
    module String

      def self.included(base)
        unless 'moneta'.respond_to?(:classify)
          base.send(:include, Extension)
        end
      end

      module Extension
        def classify_with_lower
          str = dup
          str = str.classify
          str[0] = str[0].downcase

          str
        end

        def classify
          dup.split('_').map(&:capitalize).join
        end
      end

    end
  end
end

String.send :include, Moneta::CoreExt::String

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
moneta-api-1.0.3 lib/moneta/core_ext/string.rb
moneta-api-1.0.2 lib/moneta/core_ext/string.rb