tjplurk 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tjplurk/robot.rb +2 -1
- data/lib/tjplurk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df5701cf79e570700f1af149d19112ef03bf9adf
|
4
|
+
data.tar.gz: 19bf269d2974f0de8e71030018220bcf70f27486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba577bd19c328c7174ed578f447acdd243329c296c4760fc7609e25c4e85b96c6063990aded915bb71c7cf9801665c579fdf7a9289cf40adb70514b2e6015720
|
7
|
+
data.tar.gz: 54c83bbd1d9abfb63bee4828ecffe8a6fcef6ba9c1b8b9d4ed95bf812d8159da69f07a3b8a71d038eb4f9a9bf3666fcc872d228cb1df45be8c7d3272ac5afbee
|
data/lib/tjplurk/robot.rb
CHANGED
@@ -7,7 +7,8 @@ module Tjplurk
|
|
7
7
|
def respond input
|
8
8
|
if matched = @topics.each{|topic| topic.pattern = Regexp.new(topic.pattern) if topic.pattern.is_a? String}.select{|topic| topic.pattern.match(input) }.sample
|
9
9
|
response = matched.responses.sample.content
|
10
|
-
|
10
|
+
match_data = matched.pattern.match(input)
|
11
|
+
response.gsub(/\\(\d+)/){|s| match_data[$1.to_i]}
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
data/lib/tjplurk/version.rb
CHANGED