Sha256: 22984f4a7fc80c99cfdf2ba6b35b16ef23126699185d688b871f8e6dcc20d044

Contents?: true

Size: 871 Bytes

Versions: 46

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

require "danger/danger_core/messages/base"

module Danger
  class Markdown < BaseMessage
    def initialize(message, file = nil, line = nil)
      super(type: :markdown, message: message, file: file, line: line)
    end

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

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

    def hash
      h = 1
      h = h * 31 + message.hash
      h = h * 17 + file.hash
      h * 17 + line.hash
    end

    def to_s
      extra = []
      extra << "file: #{file}" unless file
      extra << "line: #{line}" unless line

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

    def <=>(other)
      return 1 if other.type != :markdown

      compare_by_file_and_line(other)
    end
  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
danger-additional-logging-0.0.3 lib/danger/danger_core/messages/markdown.rb
danger-additional-logging-0.0.2 lib/danger/danger_core/messages/markdown.rb
danger-additional-logging-0.0.1 lib/danger/danger_core/messages/markdown.rb
danger-9.3.1 lib/danger/danger_core/messages/markdown.rb
danger-9.3.0 lib/danger/danger_core/messages/markdown.rb
danger-9.2.0 lib/danger/danger_core/messages/markdown.rb