Class: ZIG::Lines

Inherits:
Object
  • Object
show all
Defined in:
lib/zig/lines.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Lines

Returns a new instance of Lines.



4
5
6
# File 'lib/zig/lines.rb', line 4

def initialize(file)
  @file, @current, @num = file, file.gets, 1
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



2
3
4
# File 'lib/zig/lines.rb', line 2

def current
  @current
end

#numObject (readonly)

Returns the value of attribute num.



2
3
4
# File 'lib/zig/lines.rb', line 2

def num
  @num
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/zig/lines.rb', line 8

def empty?
  @current.nil?
end

#nextObject



12
13
14
# File 'lib/zig/lines.rb', line 12

def next
  @current, @num = @file.gets, @num + 1
end