Class: Calyx::Format::Trace
- Inherits:
-
Object
- Object
- Calyx::Format::Trace
- Defined in:
- lib/calyx/format.rb
Instance Method Summary collapse
- #absolute_path ⇒ Object
-
#initialize(match_symbol, filename, contents) ⇒ Trace
constructor
A new instance of Trace.
- #lineno ⇒ Object
- #path ⇒ Object
Constructor Details
#initialize(match_symbol, filename, contents) ⇒ Trace
Returns a new instance of Trace.
8 9 10 11 12 |
# File 'lib/calyx/format.rb', line 8 def initialize(match_symbol, filename, contents) @match_symbol = match_symbol @filename = Pathname.new(filename) @contents = contents end |
Instance Method Details
#absolute_path ⇒ Object
18 19 20 |
# File 'lib/calyx/format.rb', line 18 def absolute_path @filename. end |
#lineno ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/calyx/format.rb', line 22 def lineno line_number = 0 @contents.each_line do |line| line_number += 1 return line_number if line =~ @match_symbol end end |
#path ⇒ Object
14 15 16 |
# File 'lib/calyx/format.rb', line 14 def path @filename.basename end |