class Danger::Comment

Attributes

body[R]
id[R]

Public Class Methods

from_github(comment) click to toggle source
# File lib/danger/helpers/comment.rb, line 11
def self.from_github(comment)
  self.new(comment["id"], comment["body"])
end
from_gitlab(comment) click to toggle source
# File lib/danger/helpers/comment.rb, line 15
def self.from_gitlab(comment)
  if comment.respond_to?(:id) && comment.respond_to?(:body)
    type = comment.respond_to?(:type) ? comment.type : nil
    self.new(comment.id, comment.body, type == "DiffNote")
  else
    self.new(comment["id"], comment["body"], comment["type"] == "DiffNote")
  end
end
new(id, body, inline = nil) click to toggle source
# File lib/danger/helpers/comment.rb, line 5
def initialize(id, body, inline = nil)
  @id = id
  @body = body
  @inline = inline
end

Public Instance Methods

generated_by_danger?(danger_id) click to toggle source
# File lib/danger/helpers/comment.rb, line 24
def generated_by_danger?(danger_id)
  body.include?("\"generated_by_#{danger_id}\"")
end
inline?() click to toggle source
# File lib/danger/helpers/comment.rb, line 28
def inline?
  @inline.nil? ? body.include?("") : @inline
end