prpr-mention_comment 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 984db03353cee2236b86a6aa848565970c1b93b8
|
4
|
+
data.tar.gz: f3880cf92a6dcbde6ccb641979c09e4699972d4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60be6228c148ca7c96afc4474ea291c4c9975d42f1ba2556575cc463b7148fed445513fd83099c26b6b0033e2484f3359d03ebba16d9b5f98c4e448f4e6617ea
|
7
|
+
data.tar.gz: 0a7a197c52382b3750ed49df2d7c1fe1834fe44ff5a51bf96659caaf6db018905d7cb04b8e1aaef45f6df0632e4fefde35b3ef29c72aff08d52ec424ca3c18ce
|
@@ -2,6 +2,8 @@ module Prpr
|
|
2
2
|
module Action
|
3
3
|
module MentionComment
|
4
4
|
class Mention < Base
|
5
|
+
REGEXP = /@[a-zA-Z0-9_-]+/
|
6
|
+
|
5
7
|
def call
|
6
8
|
if mention?
|
7
9
|
Publisher::Adapter::Base.broadcast message
|
@@ -15,7 +17,7 @@ module Prpr
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def mention?
|
18
|
-
comment.body =~
|
20
|
+
comment.body =~ REGEXP
|
19
21
|
end
|
20
22
|
|
21
23
|
def body
|
@@ -27,7 +29,7 @@ module Prpr
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def comment_body
|
30
|
-
comment.body.gsub(
|
32
|
+
comment.body.gsub(REGEXP) { |old|
|
31
33
|
members[old] || old
|
32
34
|
}
|
33
35
|
end
|