Class: Bricolage::JobNet::Location
- Inherits:
-
Object
- Object
- Bricolage::JobNet::Location
- Defined in:
- lib/bricolage/jobnet.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file, lineno) ⇒ Location
constructor
A new instance of Location.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file, lineno) ⇒ Location
Returns a new instance of Location.
446 447 448 449 |
# File 'lib/bricolage/jobnet.rb', line 446 def initialize(file, lineno) @file = file @lineno = lineno end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
451 452 453 |
# File 'lib/bricolage/jobnet.rb', line 451 def file @file end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
452 453 454 |
# File 'lib/bricolage/jobnet.rb', line 452 def lineno @lineno end |
Class Method Details
.dummy ⇒ Object
426 427 428 |
# File 'lib/bricolage/jobnet.rb', line 426 def Location.dummy new('(dummy)', 0) end |
.for_file(f) ⇒ Object
430 431 432 |
# File 'lib/bricolage/jobnet.rb', line 430 def Location.for_file(f) new(f.path, f.lineno) end |
.for_io(io) ⇒ Object
438 439 440 441 442 443 444 |
# File 'lib/bricolage/jobnet.rb', line 438 def Location.for_io(io) if io.respond_to?(:path) for_file(io) else for_non_file(io) end end |
.for_non_file(io) ⇒ Object
434 435 436 |
# File 'lib/bricolage/jobnet.rb', line 434 def Location.for_non_file(io) new(io.inspect, io.lineno) end |
Instance Method Details
#inspect ⇒ Object
454 455 456 |
# File 'lib/bricolage/jobnet.rb', line 454 def inspect "\#<#{self.class} #{to_s}>" end |
#to_s ⇒ Object
458 459 460 |
# File 'lib/bricolage/jobnet.rb', line 458 def to_s "#{@file}:#{@lineno}" end |