class Tagline::LineManager

Attributes

lines[R]

Public Class Methods

new(filename) click to toggle source
# File lib/tagline/line_manager.rb, line 8
def initialize(filename)
  @lines = File.read(filename).split("\n").map do |line|
    Line.new(line)
  end
end

Public Instance Methods

line() click to toggle source
# File lib/tagline/line_manager.rb, line 14
def line
  lines[i]
end
next_line() click to toggle source
# File lib/tagline/line_manager.rb, line 18
def next_line
  @i = (i + 1) % length
end
previous_line() click to toggle source
# File lib/tagline/line_manager.rb, line 22
def previous_line
  @i = (i - 1) % length
end

Private Instance Methods

i() click to toggle source
# File lib/tagline/line_manager.rb, line 30
def i
  @i ||= 0
end