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 +4 -4
- data/lib/ruboty/handlers/ruby_persistence.rb +23 -9
- data/lib/ruboty/ruby_persistence/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f4bec3fee78d4f3932809af9d1df95a715959f5
|
4
|
+
data.tar.gz: f415566ff3b70d4592071ae543d941036f6ec816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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-
|
10
|
-
description: '
|
11
|
-
name: '
|
9
|
+
/ruby-define (?<name>.+?) (?<code>.+)/m,
|
10
|
+
description: 'Define persisted Ruby variable',
|
11
|
+
name: 'define',
|
12
12
|
)
|
13
13
|
|
14
14
|
on(
|
15
|
-
/ruby-
|
16
|
-
description: '
|
17
|
-
name: '
|
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
|
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
|
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
|
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
|
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.
|
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:
|
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.
|
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
|