Sha256: ceb8cfa23c6638f031b93fffc3dd54aea3d025c11342e368b7b70ed2a4180ad7

Contents?: true

Size: 626 Bytes

Versions: 1

Compression:

Stored size: 626 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, :inclusive)
      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

1 entries across 1 versions & 1 rubygems

Version Path
loaf-0.6.1 lib/loaf/crumb.rb