ruboty-response 0.0.2 → 0.0.3

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: 8208c3397ff894e3c1267a4e015631aa71a66e0d
4
- data.tar.gz: 25e4621df15b7baf5d553dfd7dfdad0c590134a1
3
+ metadata.gz: a3bf40f5fc68b13548d71aa1d00c1b382a2ee51c
4
+ data.tar.gz: d16615139a10a828f4f542840bf59c2b7d049968
5
5
  SHA512:
6
- metadata.gz: 41648b1c9739c2f131c2e70fcf6b2b8b4facc46ca1d06e2bdc4f1b021c0c59c61519792909928e479a32e7cfc4b6a817522efbb53d3c53da404306de14b6278d
7
- data.tar.gz: 11a1d78576e5ff0109b29a4a8c55ca0386094091ad71eac1f721de6be0ac5cdddbf5372ade8f8c75cf74a961b9d97c73deecc7544b825297d786a5a3a2b299f4
6
+ metadata.gz: 1866ebc309e466d32c8e2bf5ae9daa55d8a359d46f09d5e1360f467c7e189b740ab3bdc17a8c6b57ae75094998ca1ea849e5cdebb7a877963da7b56ffd4a664e
7
+ data.tar.gz: 8dc97b22585c9013462c509f65883ba0b71b01562bf7821417a6ddb3bd7c329e829297100c8188237024ef0ad72795a5247a478d32f22814561efd2d43e666ce
data/README.md CHANGED
@@ -22,7 +22,7 @@ gem 'ruboty-response'
22
22
 
23
23
  ```
24
24
  > @ruboty add response /^foo$/ bar
25
- Response 533 registered.
25
+ Response 533 is registered.
26
26
  > foo
27
27
  bar
28
28
  > fooo
@@ -7,7 +7,7 @@ module Ruboty
7
7
 
8
8
  on /add response \/(?<regex>.+)\/ (?<response>.+)/, name: 'add', description: 'Add a response'
9
9
  on /delete response (?<id>.+)/, name: 'delete', description: 'Delete a response'
10
- on /list responses/, name: 'list', description: 'Show registered responses'
10
+ on /list responses\z/, name: 'list', description: 'Show registered responses'
11
11
 
12
12
  def catchall(message)
13
13
  responses.each do |id, hash|
@@ -27,28 +27,26 @@ module Ruboty
27
27
  # Insert to the brain
28
28
  responses[id] = hash
29
29
 
30
- message.reply("Response #{id} registered.")
30
+ message.reply("Response #{id} is registered.")
31
31
  end
32
32
 
33
33
  def delete(message)
34
34
  if responses.delete(message[:id].to_i)
35
- message.reply('Deleted.')
35
+ message.reply("Response #{message[:id]} is unregistered.")
36
36
  else
37
- message.reply('Not found.')
37
+ message.reply("Response #{message[:id]} is not found.")
38
38
  end
39
39
  end
40
40
 
41
41
  def list(message)
42
- body =
43
- if responses.empty?
44
- 'No response registered.'
45
- else
46
- responses.map do |id, hash|
47
- "#{id}: /#{hash[:regex]}/ -> #{hash[:response]}"
48
- end.join("\n")
49
- end
50
-
51
- message.reply(body)
42
+ if responses.empty?
43
+ message.reply('Nothing is registered.')
44
+ else
45
+ response_list = responses.map do |id, hash|
46
+ "#{id}: /#{hash[:regex]}/ -> #{hash[:response]}"
47
+ end.join("\n")
48
+ message.reply(response_list, code: true)
49
+ end
52
50
  end
53
51
 
54
52
  private
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Response
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-response
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaihar4
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-16 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty