Class: FixtureFox::DirectiveLine
- Inherits:
-
TokenizedLine
- Object
- TokenizedLine
- FixtureFox::DirectiveLine
- Defined in:
- lib/fixture_fox/line.rb
Instance Attribute Summary collapse
-
#argument ⇒ Object
readonly
Value token.
-
#directive ⇒ Object
readonly
Directive token.
Attributes inherited from TokenizedLine
#file, #indent, #initial_indent, #line, #lineno
Instance Method Summary collapse
-
#initialize(file, lineno, initial_indent, indent, line) ⇒ DirectiveLine
constructor
A new instance of DirectiveLine.
- #to_s(long: false) ⇒ Object
Methods inherited from TokenizedLine
Constructor Details
#initialize(file, lineno, initial_indent, indent, line) ⇒ DirectiveLine
Returns a new instance of DirectiveLine.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/fixture_fox/line.rb', line 60 def initialize(file, lineno, initial_indent, indent, line) super case line when /^(@schema)(\s+)(\w+)\s*(?:#.*)?$/ @directive = make_directive($1) @pos += $1.size + $2.size @argument = make_value($3) when /^(@include)(\s+)(\S+)\s*(?:#.*)?$/ @directive = make_directive($1) @pos += $1.size + $2.size @argument = make_value($3) when /^(@anchors)(\s+)(\S+)\s*(?:#.*)?$/ @directive = make_directive($1) @pos += $1.size + $2.size @argument = make_value($3) else error("Illegal directive") end end |
Instance Attribute Details
#argument ⇒ Object (readonly)
Value token
58 59 60 |
# File 'lib/fixture_fox/line.rb', line 58 def argument @argument end |
#directive ⇒ Object (readonly)
Directive token
57 58 59 |
# File 'lib/fixture_fox/line.rb', line 57 def directive @directive end |
Instance Method Details
#to_s(long: false) ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/fixture_fox/line.rb', line 80 def to_s(long: false) super + if long "directive:#{directive.pos} #{directive.litt}, argument:#{argument.pos} #{argument.litt}" else "#{directive.litt} #{argument.litt}" end end |