class Navagation
Attributes
articles_length[RW]
end_index[RW]
start_index[RW]
Public Class Methods
new(length)
click to toggle source
# File lib/nytimes_cli/navagation.rb, line 5 def initialize(length) @start_index = 0 @end_index = 9 @articles_length = length end
Public Instance Methods
less()
click to toggle source
# File lib/nytimes_cli/navagation.rb, line 22 def less if @start_index >= 10 @start_index -= 10 @end_index = @start_index + 9 else @start_index = 0 @end_index = 9 end end
more()
click to toggle source
# File lib/nytimes_cli/navagation.rb, line 12 def more if @end_index + 10 < @articles_length @start_index += 10 @end_index += 10 else @start_index = @articles_length - 9 @end_index = @articles_length end end