Class: FixtureFox::TokenizedLine
- Inherits:
-
Object
- Object
- FixtureFox::TokenizedLine
- Defined in:
- lib/fixture_fox/line.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#indent ⇒ Object
readonly
Returns the value of attribute indent.
-
#initial_indent ⇒ Object
readonly
Returns the value of attribute initial_indent.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
Instance Method Summary collapse
- #error(msg) ⇒ Object
-
#initialize(file, lineno, initial_indent, indent, line) ⇒ TokenizedLine
constructor
A new instance of TokenizedLine.
- #to_s(long: false) ⇒ Object
Constructor Details
#initialize(file, lineno, initial_indent, indent, line) ⇒ TokenizedLine
Returns a new instance of TokenizedLine.
9 10 11 12 |
# File 'lib/fixture_fox/line.rb', line 9 def initialize(file, lineno, initial_indent, indent, line) @file, @line, @lineno, @initial_indent, @indent = file, line.dup, lineno, initial_indent, indent @pos = 1 + @indent # Used to keep track of position for the make_* methods end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
3 4 5 |
# File 'lib/fixture_fox/line.rb', line 3 def file @file end |
#indent ⇒ Object (readonly)
Returns the value of attribute indent.
7 8 9 |
# File 'lib/fixture_fox/line.rb', line 7 def indent @indent end |
#initial_indent ⇒ Object (readonly)
Returns the value of attribute initial_indent.
6 7 8 |
# File 'lib/fixture_fox/line.rb', line 6 def initial_indent @initial_indent end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
4 5 6 |
# File 'lib/fixture_fox/line.rb', line 4 def line @line end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
5 6 7 |
# File 'lib/fixture_fox/line.rb', line 5 def lineno @lineno end |
Instance Method Details
#error(msg) ⇒ Object
14 15 16 |
# File 'lib/fixture_fox/line.rb', line 14 def error(msg) raise ParseError.new(@file, @lineno, @pos + initial_indent, msg) end |
#to_s(long: false) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/fixture_fox/line.rb', line 18 def to_s(long: false) if long "#{file}:#{lineno} " else "line #{lineno} " end end |