Sha256: adff45b5185a4cb0fac8bed43418f93e7266a483a17d86d213862726795a00e8

Contents?: true

Size: 376 Bytes

Versions: 3

Compression:

Stored size: 376 Bytes

Contents

# frozen_string_literal: true

# Mimics the module by the same name from Rails, to add convenience methods
module CoreExtensions
  module String
    # Adds convenience methods
    module Inflections
      def snake_case
        downcase.tr(' ', '_').gsub(/[^a-z_]/, '')
      end

      def camel_case
        split('_').collect(&:capitalize).join
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ynab_convert-1.0.2 lib/core_extensions/string.rb
ynab_convert-1.0.1 lib/core_extensions/string.rb
ynab_convert-0.1.0.pre lib/core_extensions/string.rb