Sha256: 98399fea290a465b8d8cfaae5ed31ce763a356c77070c01adfd273ba41cf99b8

Contents?: true

Size: 379 Bytes

Versions: 12

Compression:

Stored size: 379 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_0-9]/, '')
      end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ynab_convert-2.0.6 lib/core_extensions/string.rb
ynab_convert-2.0.5 lib/core_extensions/string.rb
ynab_convert-2.0.4 lib/core_extensions/string.rb
ynab_convert-2.0.3 lib/core_extensions/string.rb
ynab_convert-2.0.1 lib/core_extensions/string.rb
ynab_convert-2.0.0 lib/core_extensions/string.rb
ynab_convert-1.0.8 lib/core_extensions/string.rb
ynab_convert-1.0.7 lib/core_extensions/string.rb
ynab_convert-1.0.6 lib/core_extensions/string.rb
ynab_convert-1.0.5 lib/core_extensions/string.rb
ynab_convert-1.0.4 lib/core_extensions/string.rb
ynab_convert-1.0.3 lib/core_extensions/string.rb