Class: Bread::Crumb

Inherits:
Hash
  • Object
show all
Defined in:
lib/bread/data/crumb.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller, title, path, options) ⇒ Crumb

Returns a new instance of Crumb.



4
5
6
7
8
9
# File 'lib/bread/data/crumb.rb', line 4

def initialize(controller, title, path, options)
  self.controller = controller
  options.merge(title: title, path: path).each do |k, v|
    self[k] = v
  end
end

Instance Method Details

#current?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/bread/data/crumb.rb', line 27

def current?
  controller.view_context.current_page? path
end

#first?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/bread/data/crumb.rb', line 19

def first?
  self[:_first]
end

#last?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/bread/data/crumb.rb', line 23

def last?
  self[:_last]
end

#pathObject



15
16
17
# File 'lib/bread/data/crumb.rb', line 15

def path
  self[:path]
end

#titleObject



11
12
13
# File 'lib/bread/data/crumb.rb', line 11

def title
  self[:title]
end