Class: RakHit

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#contextObject

Returns the value of attribute context.



12
13
14
# File 'lib/janitor/rak_hit.rb', line 12

def context
  @context
end

#file_nameObject

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_numberObject

Returns the value of attribute line_number.



12
13
14
# File 'lib/janitor/rak_hit.rb', line 12

def line_number
  @line_number
end