Class: CTioga2::Commands::ParsingContext

Inherits:
Object
  • Object
show all
Defined in:
lib/ctioga2/commands/context.rb

Overview

Context of parsing, mostly for error reporting

Instance Method Summary collapse

Instance Method Details

#parsing_file(command, file, line = -1)) ⇒ Object

Currently within a file



33
34
35
36
37
38
# File 'lib/ctioga2/commands/context.rb', line 33

def parsing_file(command, file, line = -1)
  @option = nil
  @command = command
  @file = file
  @number = line
end

#parsing_option(opt, number) ⇒ Object

Currently parsing an option



27
28
29
30
# File 'lib/ctioga2/commands/context.rb', line 27

def parsing_option(opt, number)
  @option = opt
  @number = number
end

#to_sObject



40
41
42
43
44
45
46
# File 'lib/ctioga2/commands/context.rb', line 40

def to_s
  if @option
    "option #{@option} (##{@number})"
  else
    "command #{@command} in file #{@file} line #{@number}"
  end
end