Sha256: 1596d9349aed9012daed1b790172111f3aaa1ca39d8f4f9f503368264f0c64df

Contents?: true

Size: 600 Bytes

Versions: 7

Compression:

Stored size: 600 Bytes

Contents

module Danger
  class Comment
    attr_reader :id, :body

    def initialize(id, body)
      @id = id
      @body = body
    end

    def self.from_github(comment)
      self.new(comment["id"], comment["body"])
    end

    def self.from_gitlab(comment)
      if comment.respond_to?(:id) && comment.respond_to?(:body)
        self.new(comment.id, comment.body)
      else
        self.new(comment["id"], comment["body"])
      end
    end

    def generated_by_danger?(danger_id)
      body.include?("\"generated_by_#{danger_id}\"")
    end

    def inline?
      body.include?("")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
danger-6.0.4 lib/danger/helpers/comment.rb
danger-6.0.3 lib/danger/helpers/comment.rb
danger-6.0.2 lib/danger/helpers/comment.rb
danger-6.0.1 lib/danger/helpers/comment.rb
danger-6.0.0 lib/danger/helpers/comment.rb
danger-5.16.1 lib/danger/helpers/comment.rb
danger-5.16.0 lib/danger/helpers/comment.rb