Class: Crumby::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/crumby/entry.rb

Overview

represent an entry of a breadcrumb menu

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#labelObject

Returns the value of attribute label



5
6
7
# File 'lib/crumby/entry.rb', line 5

def label
  @label
end

#optionsObject

Returns the value of attribute options



5
6
7
# File 'lib/crumby/entry.rb', line 5

def options
  @options
end

#positionObject

Returns the value of attribute position



5
6
7
# File 'lib/crumby/entry.rb', line 5

def position
  @position
end

#routeObject

Returns the value of attribute route



5
6
7
# File 'lib/crumby/entry.rb', line 5

def route
  @route
end

#trailObject

Returns the value of attribute trail



5
6
7
# File 'lib/crumby/entry.rb', line 5

def trail
  @trail
end

Instance Method Details

#first?Boolean

Returns if first entry



15
16
17
# File 'lib/crumby/entry.rb', line 15

def first?
  position.zero?
end

#last?Boolean

Returns if last entry



21
22
23
# File 'lib/crumby/entry.rb', line 21

def last?
  (total - position - 1).zero?
end

#totalFixnum

Returns total entries



9
10
11
# File 'lib/crumby/entry.rb', line 9

def total
  trail.count
end