Sha256: 6d065d096bf11b8891e37581fab6ebd9ff8df24d486bc08bfee232e666f93091

Contents?: true

Size: 640 Bytes

Versions: 6

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module Loaf
  # Basic crumb container for internal use
  # @api private
  class Crumb
    attr_reader :name

    attr_reader :url

    attr_reader :match

    def initialize(name, url, options = {})
      @name  = name || raise_name_error
      @url   = url || raise_url_error
      @match = options.fetch(:match, Loaf.configuration.match)
      freeze
    end

    def raise_name_error
      raise ArgumentError, 'breadcrumb first argument, `name`, cannot be nil'
    end

    def raise_url_error
      raise ArgumentError, 'breadcrumb second argument, `url`, cannot be nil'
    end
  end # Crumb
end # Loaf

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
loaf-0.10.0 lib/loaf/crumb.rb
loaf-0.9.0 lib/loaf/crumb.rb
loaf-0.8.1 lib/loaf/crumb.rb
loaf-0.8.0 lib/loaf/crumb.rb
loaf-0.7.0 lib/loaf/crumb.rb
loaf-0.6.2 lib/loaf/crumb.rb