Class: CC::Analyzer::LocationDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/analyzer/location_description.rb

Instance Method Summary collapse

Constructor Details

#initialize(location, suffix = "") ⇒ LocationDescription



4
5
6
7
# File 'lib/cc/analyzer/location_description.rb', line 4

def initialize(location, suffix = "")
  @location = location
  @suffix = suffix
end

Instance Method Details

#to_sObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cc/analyzer/location_description.rb', line 9

def to_s
  str = ""
  if location["lines"]
    str << render_lines
  elsif positions = location["positions"]
    str << render_position(positions["begin"])

    if positions["end"]
      str << "-"
      str << render_position(positions["end"])
    end
  end

  str << suffix unless str.blank?

  str
end