Sha256: 701f2e0dc7c84fead80e332582fdde39f290c918b88bd392b194101f31849966

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 Bytes

Contents

# encoding: utf-8

# @api private
module Nanoc::StringExtensions
  # Transforms string into an actual identifier
  #
  # @return [String] The identifier generated from the receiver
  def __nanoc_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 __nanoc_checksum
    Nanoc::Int::Checksummer.calc(self)
  end
end

# @api private
class String
  include Nanoc::StringExtensions
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 lib/nanoc/base/core_ext/string.rb
nanoc-4.0.0b1 lib/nanoc/base/core_ext/string.rb
nanoc-4.0.0a2 lib/nanoc/base/core_ext/string.rb
nanoc-4.0.0a1 lib/nanoc/base/core_ext/string.rb