ruboty-ruby_persistence 0.1.4 → 0.2.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: 14d35d6042c421a1d15051f95a3391052538fc6d
4
- data.tar.gz: ce10f722debf3f1ed76765735b5f40b9bc3ac432
3
+ metadata.gz: 3f4bec3fee78d4f3932809af9d1df95a715959f5
4
+ data.tar.gz: f415566ff3b70d4592071ae543d941036f6ec816
5
5
  SHA512:
6
- metadata.gz: 61a455cb07e949ab6286b806cc276496aa3f88408ee02d39fac1715080e73d6815a6db92c06bf8d711506e2f545746ae36f2f243702d52170bd9e7fed1afc9bd
7
- data.tar.gz: 8ef775aabf4f7f7aafab8a8c5ecaf6e499f249168fbcc1c1a45584bf8708de96faf712a085aa441102cf8fea346d5d0ae43b3af21010c7b69801967a4be5d8b9
6
+ metadata.gz: 1faf97d4b8fbddb9fa1bf4c541386450a9b63670c8660b29d0fe8757a7fbd1cd6b1b196c5883775ec12f12072e71f4021eb6f0be6e64c226c1dc1c14d13554bd
7
+ data.tar.gz: f3c60b22cae744d940ad276c61032414576e95594cc9895cff518e6b1b3bda45091b7446de330df9ce139be59c4f59023a228129888380433309a8af3767f65a
@@ -6,15 +6,21 @@ module Ruboty
6
6
  NAMESPACE = 'ruby_persistence'.freeze
7
7
 
8
8
  on(
9
- /ruby-set (?<name>.+?) (?<code>.+)/m,
10
- description: 'Set persisted Ruby variable',
11
- name: 'set',
9
+ /ruby-define (?<name>.+?) (?<code>.+)/m,
10
+ description: 'Define persisted Ruby variable',
11
+ name: 'define',
12
12
  )
13
13
 
14
14
  on(
15
- /ruby-unset (?<name>.+)/m,
16
- description: 'Unset persisted Ruby variable',
17
- name: 'unset',
15
+ /ruby-undefine (?<name>.+)/m,
16
+ description: 'Undefine persisted Ruby variable',
17
+ name: 'undefine',
18
+ )
19
+
20
+ on(
21
+ /list ruby-definitions\z/,
22
+ description: 'List all persisted Ruby variables',
23
+ name: 'list'
18
24
  )
19
25
 
20
26
  def initialize(*)
@@ -22,7 +28,7 @@ module Ruboty
22
28
  restore
23
29
  end
24
30
 
25
- def set(message)
31
+ def define(message)
26
32
  name = message[:name]
27
33
 
28
34
  if !variables.key?(name) && (method = predefined_method(name))
@@ -32,18 +38,26 @@ module Ruboty
32
38
  end
33
39
  end
34
40
 
35
- def unset(message)
41
+ def undefine(message)
36
42
  name = message[:name]
37
43
 
38
44
  if variables[name]
39
45
  undefine_variable(name)
40
46
  variables.delete(name)
41
- message.reply("`#{name}` is now unset")
47
+ message.reply("`#{name}` is now undefined")
42
48
  else
43
49
  message.reply("Error: No such variable `#{name}`")
44
50
  end
45
51
  end
46
52
 
53
+ def list(message)
54
+ summary = variables.map do |name, value|
55
+ "#{name}: #{value.inspect}"
56
+ end.join("\n")
57
+
58
+ message.reply(summary, code: true)
59
+ end
60
+
47
61
  private
48
62
 
49
63
  def restore
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module RubyPersistence
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-ruby_persistence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-19 00:00:00.000000000 Z
11
+ date: 2016-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.4.8
94
+ rubygems_version: 2.5.1
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: A Ruboty handler for persisting Ruby variables