class Dug::NotificationDecorator
Public Instance Methods
headers()
click to toggle source
# File lib/dug/notification_decorator.rb, line 21 def headers @headers ||= payload.headers.each_with_object({}) do |header, hash| hash[header.name] = header.value end end
indicates_closed?()
click to toggle source
# File lib/dug/notification_decorator.rb, line 31 def indicates_closed? # Note: Purposely more lax than Merged # Issues can be closed via PR/commit ie "Closed #123 via #456." !!(plaintext_body =~ /^Closed #(?:\d+)/) end
indicates_merged?()
click to toggle source
# File lib/dug/notification_decorator.rb, line 27 def indicates_merged? !!(plaintext_body =~ /^Merged #(?:\d+)\./) end
indicates_reopened?()
click to toggle source
# File lib/dug/notification_decorator.rb, line 37 def indicates_reopened? !!(plaintext_body =~ /^Reopened #(?:\d+)\./) end
organization()
click to toggle source
# File lib/dug/notification_decorator.rb, line 9 def organization list_match(1) end
reason()
click to toggle source
# File lib/dug/notification_decorator.rb, line 17 def reason headers["X-GitHub-Reason"] end
repository()
click to toggle source
# File lib/dug/notification_decorator.rb, line 13 def repository list_match(2) end
Private Instance Methods
list_match(index)
click to toggle source
# File lib/dug/notification_decorator.rb, line 43 def list_match(index) headers["List-ID"] && headers["List-ID"].match(/^([\w\-_]+)\/([\w\-_]+)/)[index] end
plaintext_body()
click to toggle source
# File lib/dug/notification_decorator.rb, line 47 def plaintext_body @plaintext_body ||= \ begin parts = payload.parts || Array(payload) parts.detect { |part| part.mime_type == 'text/plain' }.body.data end end