Class: Danger::Helpers::CommentsHelper::Comment

Inherits:
Object
  • Object
show all
Defined in:
lib/danger/helpers/comments_helper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, body) ⇒ Comment

Returns a new instance of Comment.



126
127
128
129
# File 'lib/danger/helpers/comments_helper.rb', line 126

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

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



124
125
126
# File 'lib/danger/helpers/comments_helper.rb', line 124

def body
  @body
end

#idObject (readonly)

Returns the value of attribute id.



124
125
126
# File 'lib/danger/helpers/comments_helper.rb', line 124

def id
  @id
end

Class Method Details

.from_github(comment) ⇒ Object



131
132
133
# File 'lib/danger/helpers/comments_helper.rb', line 131

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

.from_gitlab(comment) ⇒ Object



135
136
137
# File 'lib/danger/helpers/comments_helper.rb', line 135

def self.from_gitlab(comment)
  self.new(comment.id, comment.body)
end

Instance Method Details

#generated_by_danger?(danger_id) ⇒ Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/danger/helpers/comments_helper.rb', line 139

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