Class: RakHit
- Inherits:
-
Object
- Object
- RakHit
- Defined in:
- lib/janitor/rak_hit.rb
Overview
This represents a single search hit from the Rak gem. The raw output looks like:
lib/file_name.rb 10|require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
This is a file name, then line number, followed by a pipe, then finally the context within that file
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
Instance Method Summary collapse
-
#initialize(raw_hit) ⇒ RakHit
constructor
A new instance of RakHit.
Constructor Details
#initialize(raw_hit) ⇒ RakHit
Returns a new instance of RakHit.
14 15 16 |
# File 'lib/janitor/rak_hit.rb', line 14 def initialize(raw_hit) self.file_name, self.line_number, self.context = raw_hit.scan(/(.+?)\s*(\d+)\|\s*(.+)/).first end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
12 13 14 |
# File 'lib/janitor/rak_hit.rb', line 12 def context @context end |
#file_name ⇒ Object
Returns the value of attribute file_name.
12 13 14 |
# File 'lib/janitor/rak_hit.rb', line 12 def file_name @file_name end |
#line_number ⇒ Object
Returns the value of attribute line_number.
12 13 14 |
# File 'lib/janitor/rak_hit.rb', line 12 def line_number @line_number end |