Class: Sinicum::Navigation::NavigationStatus

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#countObject (readonly)

Returns the value of attribute count.



6
7
8
# File 'lib/sinicum/navigation/navigation_status.rb', line 6

def count
  @count
end

#sizeObject (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

Returns:

  • (Boolean)


13
14
15
# File 'lib/sinicum/navigation/navigation_status.rb', line 13

def first?
  count == 0
end

#last?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/sinicum/navigation/navigation_status.rb', line 17

def last?
  count == size - 1
end

#to_sObject



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