Sha256: 5ab193c7f7f312937684ead6e1899963a726453df21cefd0347a4a64694df58a

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 Bytes

Contents

# encoding: utf-8

module Loaf
  # A mixin for formatting crumb name
  module CrumbFormatter
    # @param [String] name
    #   the name to format
    #
    # @api public
    def format_name(name, options = {})
      return name if name.nil? || name.empty?

      formatted = name.to_s.dup
      formatted = Loaf::Translation.find_title(formatted)
      formatted = formatted.capitalize if options[:capitalize]
      if options[:crumb_length]
        formatted = truncate(formatted, length: options[:crumb_length])
      end
      formatted
    end
  end # CrumbFormatter
end # Loaf

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loaf-0.5.0 lib/loaf/crumb_formatter.rb