Class: Corundum::QA::Rejection

Inherits:
Object
  • Object
show all
Defined in:
lib/corundum/qa-report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, file, line = nil, value = nil) ⇒ Rejection

Returns a new instance of Rejection.



43
44
45
# File 'lib/corundum/qa-report.rb', line 43

def initialize(label, file, line = nil, value = nil)
  @file, @line, @label, @value = file, line, label, value
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



46
47
48
# File 'lib/corundum/qa-report.rb', line 46

def file
  @file
end

#labelObject (readonly)

Returns the value of attribute label.



46
47
48
# File 'lib/corundum/qa-report.rb', line 46

def label
  @label
end

#lineObject (readonly)

Returns the value of attribute line.



46
47
48
# File 'lib/corundum/qa-report.rb', line 46

def line
  @line
end

#valueObject (readonly)

Returns the value of attribute value.



46
47
48
# File 'lib/corundum/qa-report.rb', line 46

def value
  @value
end

Instance Method Details

#file_and_lineObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/corundum/qa-report.rb', line 48

def file_and_line
  @file_and_line ||=
    begin
      if line.nil?
        file
      else
        [file, line].join(":")
      end
    end
end

#to_s(column_widths = nil) ⇒ Object



59
60
61
62
63
64
65
66
67
68
# File 'lib/corundum/qa-report.rb', line 59

def to_s(column_widths=nil)
  column_widths ||= {}
  [:file_and_line, :label, :value].map do |name|
    if column_widths.has_key?(name)
      self.send(name).to_s.ljust(column_widths[name])
    else
      self.send(name).to_s
    end
  end.join('  ')
end