Class: Sinicum::Navigation::NavigationStatus
- Inherits:
-
Object
- Object
- Sinicum::Navigation::NavigationStatus
- Defined in:
- lib/sinicum/navigation/navigation_status.rb
Overview
Public: Provides meta-information about the status of a NavigationElement in the iteration.
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #first? ⇒ Boolean
-
#initialize(size, count) ⇒ NavigationStatus
constructor
A new instance of NavigationStatus.
- #last? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(size, count) ⇒ NavigationStatus
Returns a new instance of NavigationStatus.
8 9 10 11 |
# File 'lib/sinicum/navigation/navigation_status.rb', line 8 def initialize(size, count) @size = size @count = count end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
6 7 8 |
# File 'lib/sinicum/navigation/navigation_status.rb', line 6 def count @count end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'lib/sinicum/navigation/navigation_status.rb', line 6 def size @size end |
Instance Method Details
#first? ⇒ Boolean
13 14 15 |
# File 'lib/sinicum/navigation/navigation_status.rb', line 13 def first? count == 0 end |
#last? ⇒ Boolean
17 18 19 |
# File 'lib/sinicum/navigation/navigation_status.rb', line 17 def last? count == size - 1 end |
#to_s ⇒ Object
21 22 23 24 |
# File 'lib/sinicum/navigation/navigation_status.rb', line 21 def to_s self.class.to_s + ": " + { size: @size, count: @count, :first? => first?, :last? => last? }.inspect end |