Sha256: bf5bf536f3352f4c105dec461b84c68ce6e3c55f158d2311a90d2d519fd8e56e

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

module Danger
  class Violation
    attr_accessor :message, :sticky, :file, :line

    def initialize(message, sticky, file, line)
      self.message = message
      self.sticky = sticky
      self.file = file
      self.line = line
    end

    def ==(other)
      return false if other.nil?
      return false unless other.kind_of? self.class

      other.message == message &&
        other.sticky == sticky &&
        other.file == file &&
        other.line == line
    end

    def inline?
      return (file.nil? && line.nil?) == false
    end

    def to_s
      extra = []
      extra << "sticky: true" if sticky
      extra << "file: #{file}" unless file.nil?
      extra << "line: #{line}" unless line.nil?

      "Violation #{message} { #{extra.join ', '} }"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-3.2.2 lib/danger/danger_core/messages/violation.rb
danger-3.2.1 lib/danger/danger_core/messages/violation.rb
danger-3.2.0 lib/danger/danger_core/messages/violation.rb