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.
478 479 480 481 |
# File 'lib/bricolage/jobnet.rb', line 478 def initialize(file, lineno) @file = file @lineno = lineno end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
483 484 485 |
# File 'lib/bricolage/jobnet.rb', line 483 def file @file end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
484 485 486 |
# File 'lib/bricolage/jobnet.rb', line 484 def lineno @lineno end |
Class Method Details
.dummy ⇒ Object
458 459 460 |
# File 'lib/bricolage/jobnet.rb', line 458 def Location.dummy new('(dummy)', 0) end |
.for_file(f) ⇒ Object
462 463 464 |
# File 'lib/bricolage/jobnet.rb', line 462 def Location.for_file(f) new(f.path, f.lineno) end |
.for_io(io) ⇒ Object
470 471 472 473 474 475 476 |
# File 'lib/bricolage/jobnet.rb', line 470 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
466 467 468 |
# File 'lib/bricolage/jobnet.rb', line 466 def Location.for_non_file(io) new(io.inspect, io.lineno) end |
Instance Method Details
#inspect ⇒ Object
486 487 488 |
# File 'lib/bricolage/jobnet.rb', line 486 def inspect "\#<#{self.class} #{to_s}>" end |
#to_s ⇒ Object
490 491 492 |
# File 'lib/bricolage/jobnet.rb', line 490 def to_s "#{@file}:#{@lineno}" end |