Sha256: a7ad6561d4824b8bec2b2d4ed66c58e31aa471b6c89dd647f49c4a19d617acf4

Contents?: true

Size: 373 Bytes

Versions: 1

Compression:

Stored size: 373 Bytes

Contents

class String

  # Appends a suffix to the string if the string does not already end
  # with that suffix.  Otherwise returns a duplicate of the string.
  # Equivalent to <code>gsub(/(?<!fix)$/, "fix")</code>.
  #
  # @param [String] fix suffix to append
  # @return [String] suffixed string
  def suffix(fix)
    self.end_with?(fix) ? self.dup : "#{self}#{fix}"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
casual_support-2.0.0 lib/casual_support/string/suffix.rb