Class: ZIG::Lines
- Inherits:
-
Object
- Object
- ZIG::Lines
- Defined in:
- lib/zig/lines.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#num ⇒ Object
readonly
Returns the value of attribute num.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(file) ⇒ Lines
constructor
A new instance of Lines.
- #next ⇒ Object
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
#current ⇒ Object (readonly)
Returns the value of attribute current.
2 3 4 |
# File 'lib/zig/lines.rb', line 2 def current @current end |
#num ⇒ Object (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
8 9 10 |
# File 'lib/zig/lines.rb', line 8 def empty? @current.nil? end |
#next ⇒ Object
12 13 14 |
# File 'lib/zig/lines.rb', line 12 def next @current, @num = @file.gets, @num + 1 end |