lita-pebbles 0.2.0 → 0.2.1

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: a4f8acb3fe39534d16f56deecb02eaa7cee464ba
4
- data.tar.gz: 453c45dcf2d482eaffeac9a04ef2cbe7af41dd5b
3
+ metadata.gz: 27f7f0d6f1386a56dd54e65e5faa3b9d26bc9bd7
4
+ data.tar.gz: 24451f86ece4deabc39dc7911bc423361b09042a
5
5
  SHA512:
6
- metadata.gz: 6b2eae867da55d2790f873a3893d8f03ecff505be949d49fa58a9a44d9c7dc9ce7c80227bcd479e4d314b500cf5e63153ebcd571b47ae0d2f85f6bb620e6e5d5
7
- data.tar.gz: a77a4ec6443bfc44072b20e5081c2e7bb6ac5edcd94686fe45fd4cebf45f220db1b025bf0a89cdb2418d57e52d6687ce8d6e2ea79066b5cb7748e8ceb55b10de
6
+ metadata.gz: 7d62f35cfa3d15f840b4878ca1d78ffae22d370379c2406bd55e039f04e99f5fa94c36e618af67f8b32569c69218240c1caa3fc0d9333093d8320f87edc03c4d
7
+ data.tar.gz: 42661c2909e30046ebf6a4d24e3edbe7e27afc888a5c9745269138ba65a3d5be55b3b49edec56ef6339484568ce75da19e974009c04d8effe29a2793eb59df88
@@ -2,11 +2,18 @@ module Lita
2
2
  module Handlers
3
3
  class Sample < Handler
4
4
 
5
- route /^sample (.+)/, :sample, command: false,
6
- help: { "sample [foo] [bar] [baz]" => "[foo] に決めた!" }
5
+ route /^sample (?:([0-9]) )?(.+)/, :sample, command: false,
6
+ help: { 'sample [n] [foo] [bar] [baz]...' => '[foo] に決めた!' }
7
7
  def sample(response)
8
- list = response.matches[0][0].split
9
- response.reply "#{list.sample} に決めた!"
8
+ total, list = response.matches.flatten
9
+ total ||= 1
10
+ list = list.split.shuffle
11
+
12
+ total.to_i.times do
13
+ item = list.pop
14
+ break unless item
15
+ response.reply "#{item} に決めた!"
16
+ end
10
17
  end
11
18
  end
12
19
  Lita.register_handler(Sample)
@@ -1,5 +1,5 @@
1
1
  module Lita
2
2
  module Pebbles
3
- VERSION = "0.2.0"
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-pebbles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-30 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.4.5
157
+ rubygems_version: 2.6.3
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: A Lita handlers for fun :)