Sha256: 72804cac324b1e1bd6ed08809a5b203baa0b53dab527fa466ca4e26cbb12209c

Contents?: true

Size: 468 Bytes

Versions: 12

Compression:

Stored size: 468 Bytes

Contents

# frozen_string_literal: true

module PageMagic
  module Utils
    # module String - contains methods for manipulating strings
    module String
      class << self
        # convert a snake case `String` or `Symbol`
        # @example
        #  classify(:snake_case) # => "SnakeCase"
        # @return [String]
        def classify(string_or_symbol)
          string_or_symbol.to_s.split('_').collect(&:capitalize).reduce(:+)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
page_magic-2.0.13 lib/page_magic/utils/string.rb
page_magic-2.0.12 lib/page_magic/utils/string.rb
page_magic-2.0.11 lib/page_magic/utils/string.rb
page_magic-2.0.10 lib/page_magic/utils/string.rb
page_magic-2.0.9 lib/page_magic/utils/string.rb
page_magic-2.0.6 lib/page_magic/utils/string.rb
page_magic-2.0.5 lib/page_magic/utils/string.rb
page_magic-2.0.4 lib/page_magic/utils/string.rb
page_magic-2.0.3 lib/page_magic/utils/string.rb
page_magic-2.0.2 lib/page_magic/utils/string.rb
page_magic-2.0.1 lib/page_magic/utils/string.rb
page_magic-2.0.0 lib/page_magic/utils/string.rb