lib/github: add `Comment::is_ack` to detect acknowledgments
authorJean Privat <jean@pryen.org>
Fri, 8 May 2015 18:20:33 +0000 (14:20 -0400)
committerJean Privat <jean@pryen.org>
Fri, 8 May 2015 18:20:33 +0000 (14:20 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/github/api.nit

index ea516fa..6f7c7d9 100644 (file)
@@ -1016,6 +1016,12 @@ abstract class Comment
 
        # Comment body text.
        fun body: String do return json["body"].to_s
+
+       # Does the comment contain an acknowledgement (+1)
+       fun is_ack: Bool
+       do
+               return body.has("\\+1\\b".to_re) or body.has(":+1:") or body.has(":shipit:")
+       end
 end
 
 # A comment made on a commit.