Class: Loaf::Breadcrumb

Inherits:
Object
  • Object
show all
Defined in:
lib/loaf/breadcrumb.rb

Overview

A container for breadcrumb values

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path, current) ⇒ Breadcrumb

Returns a new instance of Breadcrumb.



14
15
16
17
18
19
# File 'lib/loaf/breadcrumb.rb', line 14

def initialize(name, path, current)
  @name = name
  @path = path
  @current = current
  freeze
end

Instance Attribute Details

#nameObject (readonly)



5
6
7
# File 'lib/loaf/breadcrumb.rb', line 5

def name
  @name
end

#pathObject (readonly) Also known as: url



7
8
9
# File 'lib/loaf/breadcrumb.rb', line 7

def path
  @path
end

Class Method Details

.[](*args) ⇒ Object



10
11
12
# File 'lib/loaf/breadcrumb.rb', line 10

def self.[](*args)
  new(*args)
end

Instance Method Details

#current?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/loaf/breadcrumb.rb', line 21

def current?
  @current
end

#to_aryObject Also known as: to_a



25
26
27
# File 'lib/loaf/breadcrumb.rb', line 25

def to_ary
  [@name, @path, @current]
end