Sha256: 3d75d672b043d1562e761f84b8b6175a618f95891ebf18a85f616b112db1a4d0

Contents?: true

Size: 535 Bytes

Versions: 2

Compression:

Stored size: 535 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

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 lib/nanoc/base/core_ext/string.rb
nanoc-3.7.5 lib/nanoc/base/core_ext/string.rb