Sha256: c52e8565ae23f75f67d2f9857d6ec60a9b7de87664506374c44f895335467677

Contents?: true

Size: 537 Bytes

Versions: 7

Compression:

Stored size: 537 Bytes

Contents

# encoding: utf-8

module Nanoc::StringExtensions

  # Transforms string into an actual identifier
  #
  # @return [String] The identifier generated from the receiver
  def cleaned_identifier
    "/#{self}/".gsub(/^\/+|\/+$/, '/')
  end

  # Calculates the checksum for this string. Any change to this string will
  # result in a different checksum.
  #
  # @return [String] The checksum for this string
  #
  # @api private
  def checksum
    Nanoc::Checksummer.calc(self)
  end

end

class String
  include Nanoc::StringExtensions
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nanoc-3.7.4 lib/nanoc/base/core_ext/string.rb
nanoc-3.7.3 lib/nanoc/base/core_ext/string.rb
nanoc-3.7.2 lib/nanoc/base/core_ext/string.rb
nanoc-3.7.1 lib/nanoc/base/core_ext/string.rb
nanoc-3.7.0 lib/nanoc/base/core_ext/string.rb
nanoc-3.6.11 lib/nanoc/base/core_ext/string.rb
nanoc-3.6.10 lib/nanoc/base/core_ext/string.rb