Class: Ripgrep::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/ripgrep/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file:, body:, raw_line:) ⇒ Match

Returns a new instance of Match.



5
6
7
8
9
# File 'lib/ripgrep/match.rb', line 5

def initialize(file:, body:, raw_line:)
  @file = file
  @body = body
  @raw_line = raw_line
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/ripgrep/match.rb', line 3

def body
  @body
end

#fileObject (readonly)

Returns the value of attribute file.



3
4
5
# File 'lib/ripgrep/match.rb', line 3

def file
  @file
end

#raw_lineObject (readonly)

Returns the value of attribute raw_line.



3
4
5
# File 'lib/ripgrep/match.rb', line 3

def raw_line
  @raw_line
end

Instance Method Details

#to_jsonObject



15
16
17
# File 'lib/ripgrep/match.rb', line 15

def to_json
  { file: file, body: body, raw_line: raw_line }.to_json
end

#to_sObject



11
12
13
# File 'lib/ripgrep/match.rb', line 11

def to_s
  raw_line
end