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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13b663a4b93ab60afdd6b5477986cdfb19a6029b
4
- data.tar.gz: 229c1a95b05d4819b019b14e8b2d656bc6aaadfe
3
+ metadata.gz: aad596b5f82cb0d07fcafd59cef70f2735323e94
4
+ data.tar.gz: 8092ea9845af09dd940dbc719d16e3d3c9317033
5
5
  SHA512:
6
- metadata.gz: cf36d8430ad6dcd355287d09e3e0aef2854705b3c1cf1c03a31df6855ef71011104dd077eef02d42582761fccf5989dc72580ab94d4c124c988c50746bcbe6c5
7
- data.tar.gz: 43250245831f93f211835d01b2b931bf740c08f065eede6b900b87300d5cf0107cdc8b7a14cccb168dd7c5da0629c2ec927cd900e54eb325500f65e5839080b0
6
+ metadata.gz: 9da37188565c88a663b69617e3bc3a8e7d8bf22637565bfbdecec868c6d7aba7e346d6e0a88a11d27e2b9fb2f5c0adf0815e6ef2e90213a2f6e2a75cd111f7fb
7
+ data.tar.gz: 35586452696c67aa31a0e0bafbc18260b0cf89fa18f07ee50d7a3034e722089314a6850e808fcc8b1b832172eea651d229081ad83834282b8976454037aba2f4
@@ -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
@@ -25,6 +25,10 @@ module Slacks
25
25
  "@#{username}"
26
26
  end
27
27
 
28
+ def ==(other)
29
+ self.class == other.class && self.id == other.id
30
+ end
31
+
28
32
  private
29
33
  attr_reader :slack
30
34
  end
@@ -1,3 +1,3 @@
1
1
  module Slacks
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.2
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-06-15 00:00:00.000000000 Z
11
+ date: 2016-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket-driver