slacks 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slacks/channel.rb +4 -20
- data/lib/slacks/user.rb +4 -0
- data/lib/slacks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aad596b5f82cb0d07fcafd59cef70f2735323e94
|
4
|
+
data.tar.gz: 8092ea9845af09dd940dbc719d16e3d3c9317033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9da37188565c88a663b69617e3bc3a8e7d8bf22637565bfbdecec868c6d7aba7e346d6e0a88a11d27e2b9fb2f5c0adf0815e6ef2e90213a2f6e2a75cd111f7fb
|
7
|
+
data.tar.gz: 35586452696c67aa31a0e0bafbc18260b0cf89fa18f07ee50d7a3034e722089314a6850e808fcc8b1b832172eea651d229081ad83834282b8976454037aba2f4
|
data/lib/slacks/channel.rb
CHANGED
@@ -27,26 +27,6 @@ module Slacks
|
|
27
27
|
end
|
28
28
|
alias :say :reply
|
29
29
|
|
30
|
-
def random_reply(replies)
|
31
|
-
if replies.is_a?(Hash)
|
32
|
-
weights = replies.values
|
33
|
-
unless weights.reduce(&:+) == 1.0
|
34
|
-
raise ArgumentError, "Reply weights don't add up to 1.0"
|
35
|
-
end
|
36
|
-
|
37
|
-
draw = rand
|
38
|
-
sum = 0
|
39
|
-
pick = nil
|
40
|
-
replies.each do |reply, weight|
|
41
|
-
pick = reply unless sum > draw
|
42
|
-
sum += weight
|
43
|
-
end
|
44
|
-
reply pick
|
45
|
-
else
|
46
|
-
reply replies.sample
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
30
|
def typing
|
51
31
|
slack.typing_on(self)
|
52
32
|
end
|
@@ -71,6 +51,10 @@ module Slacks
|
|
71
51
|
"<Slacks::Channel id=\"#{id}\" name=\"#{name}\">"
|
72
52
|
end
|
73
53
|
|
54
|
+
def ==(other)
|
55
|
+
self.class == other.class && self.id == other.id
|
56
|
+
end
|
57
|
+
|
74
58
|
def to_s
|
75
59
|
return name if private?
|
76
60
|
return "@#{name}" if direct_message?
|
data/lib/slacks/user.rb
CHANGED
data/lib/slacks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-driver
|