ruboty-variable 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0fff3ceeaa8addea381f98b4f36d85a681205d4
4
- data.tar.gz: e921ed243f4c2d2593f88719215b32dfcf6116de
3
+ metadata.gz: fb8e5f840f7ccaebfce105e659c9ea6beda3971c
4
+ data.tar.gz: 65edd0653a07a661bdeb26bac79910e9248b6edf
5
5
  SHA512:
6
- metadata.gz: d04da308acd3c10628dca0bd70c92663a148528410b05a74f009ee4d78f94101bb1a02b57853bb07bcded1c08debc6208386eeb32b4c2954c3f596e7af11c10b
7
- data.tar.gz: 155c1f7d1606b2b3c41ddc6423d6971965d597158e4b7301144c3054dc0f9cb7cdcc7d9b6af563941bdc8f5791c93a5ff7b62229a6a1998235c69a89139aeaed
6
+ metadata.gz: f23b3bee227208142e4d9b3086effadc1fbbaf7a30f061b2d80fa748b99ff28cf83c1df3e55505cff44abcaeefbed044c77cc4d690c9eafe2cafca2634276ff5
7
+ data.tar.gz: bf4d81183ba16c8c706bd14fbf4ed3a3ea770694b861487e8963e04f190475c99de806a3c01e50ecc2f741c5c952da4e85f11dc724daa8e348e9fcb27aa0cf66
data/README.md CHANGED
@@ -66,7 +66,7 @@ Set 3 to hoge
66
66
  > ruboty var set piyo piyo_value
67
67
  Set piyo_value to piyo
68
68
  > ruboty var list
69
- key, type value
69
+ key type value
70
70
  hoge - string - 3
71
71
  piyo - string - piyo_value
72
72
  ~~~
@@ -78,7 +78,7 @@ piyo - string - piyo_value
78
78
  > ruboty var array init ary
79
79
  Created ary empty array
80
80
  > ruboty var list
81
- key, type value
81
+ key type value
82
82
  ary - array - []
83
83
  ~~~
84
84
 
@@ -94,7 +94,7 @@ Push one to ary
94
94
  Push two to ary
95
95
  Push three to ary
96
96
  > ruboty var list
97
- key, type value
97
+ key type value
98
98
  ary - array - ["one", "two", "three"]
99
99
  ~~~
100
100
 
@@ -114,7 +114,7 @@ Push three to ary
114
114
  ary already included one
115
115
  ary already included two
116
116
  > ruboty var list
117
- key, type value
117
+ key type value
118
118
  ary - array - ["one", "two", "three"]
119
119
  ~~~
120
120
 
@@ -38,6 +38,59 @@ module Ruboty
38
38
  def array_remove(message)
39
39
  Ruboty::Variable::Actions::Variable.new(message).array_push(message[:key], message[:values])
40
40
  end
41
+
42
+ on /var test\z/, name: 'test_values', hide: true
43
+
44
+ def test_values(message)
45
+ var = Ruboty::Variable::Actions::Variable.new(message)
46
+ puts '# set'
47
+ var.set("hoge", "hoge_value")
48
+ var.set("123457", "999")
49
+ var.set("aohef23", "awef8a23a3a32")
50
+ var.set("string", "string_value")
51
+
52
+ puts "\n# get"
53
+ var.get("hoge")
54
+ var.get("piyo")
55
+
56
+ puts "\n# list"
57
+ var.list
58
+
59
+ puts "\n# delete"
60
+ var.delete("hoge")
61
+ var.delete("hoge")
62
+ var.list
63
+
64
+ puts "\n# init array"
65
+ var.array_init("ary")
66
+ var.array_init("string")
67
+ var.array_init("string")
68
+ var.list
69
+
70
+ puts "\n# push array"
71
+ var.array_push("ary", "one")
72
+ var.array_push("ary", "two")
73
+ var.array_push("ary", "two")
74
+ var.list
75
+
76
+ puts "\n# push array to empty array"
77
+ var.array_push("hoge", "kkkk")
78
+ var.array_push("zxcv", "pppp")
79
+
80
+ puts "\n# push values to array"
81
+ var.array_push("ary", "three four five")
82
+ var.list
83
+
84
+ puts "\n# remove values from array"
85
+ var.array_remove("ary", "one three")
86
+ var.list
87
+
88
+ puts "\n# remove error"
89
+ var.array_remove("ary", "one three")
90
+ var.array_remove("noary", "one")
91
+ var.array_remove("123457", "one")
92
+ var.list
93
+ end
41
94
  end
42
95
  end
43
96
  end
@@ -91,7 +91,7 @@ module Ruboty
91
91
  key_len = [max_key_length, 'key'.size].max
92
92
  type_len = [max_type_length, 'type'.size].max
93
93
 
94
- mes = "%-#{key_len}s %-#{type_len}s value\n" % %w(key, type)
94
+ mes = "%-#{key_len}s %-#{type_len}s value\n" % %w(key type)
95
95
  mes << @var.values.map do |k, v|
96
96
  "%-#{key_len}s - %-#{type_len}s - #{v[:value]}" % [k, v[:type]]
97
97
  end.join("\n")
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Variable
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-variable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - snakazawa