Class: Cucumber::Ast::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/ast/location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line) ⇒ Location

Returns a new instance of Location.



7
8
9
10
# File 'lib/cucumber/ast/location.rb', line 7

def initialize(file, line)
  @file = file || raise(ArgumentError, "file is mandatory")
  @line = line || raise(ArgumentError, "line is mandatory")
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



5
6
7
# File 'lib/cucumber/ast/location.rb', line 5

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



5
6
7
# File 'lib/cucumber/ast/location.rb', line 5

def line
  @line
end

Instance Method Details

#on_line(new_line) ⇒ Object



16
17
18
# File 'lib/cucumber/ast/location.rb', line 16

def on_line(new_line)
  Location.new(file, new_line)
end

#to_sObject



12
13
14
# File 'lib/cucumber/ast/location.rb', line 12

def to_s
  "#{file}:#{line}"
end