condition 0.0.20 → 0.0.21
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 +4 -4
- data/README.md +4 -0
- data/lib/condition/param.rb +2 -0
- data/lib/condition/param_item.rb +1 -1
- data/lib/condition/version.rb +1 -1
- data/spec/condition_spec.rb +27 -2
- data/spec/files/t_user.ods +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a35a3befff8b198904309c0b89f9aefd3e7882f4
|
4
|
+
data.tar.gz: 4464c12614d73dd49721c9feb5db1ac28efd1f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a6c22a9ec01f890b6b1b987a2990064cee78700963088bdf44c6b3e79f03ba14607b6382f1fa213bc7b72572b8ce30c72da6c602cfcf2858a821e5ee6c6a171
|
7
|
+
data.tar.gz: cf32216dd84543a2ed579050a222ac3d30bf0b7f48fef5e6abee7d97c081e272892bd95e1e06dc0471b034edf1defe1b96a8f0d7be4834bcaf0e731ba8629aad
|
data/README.md
CHANGED
data/lib/condition/param.rb
CHANGED
@@ -50,9 +50,11 @@ module Condition
|
|
50
50
|
|
51
51
|
def check(name, data)
|
52
52
|
item = item(name)
|
53
|
+
item.clear_used_values
|
53
54
|
data.each do |line|
|
54
55
|
item.check_line(line)
|
55
56
|
end
|
57
|
+
raise "#{item.name} not exists row" if item.is_remain_value
|
56
58
|
end
|
57
59
|
|
58
60
|
def pre(storage, default=nil)
|
data/lib/condition/param_item.rb
CHANGED
@@ -6,7 +6,7 @@ module Condition
|
|
6
6
|
class ParamItem
|
7
7
|
def initialize(rows)
|
8
8
|
@name = rows[0][0].to_sym
|
9
|
-
@options = rows[0].size > 1 ? rows[0][1..rows.size - 1] : []
|
9
|
+
@options = rows[0].size > 1 ? rows[0][1..rows[0].size - 1] : []
|
10
10
|
body = rows[1..rows.size - 1]
|
11
11
|
@values = []
|
12
12
|
@keys = []
|
data/lib/condition/version.rb
CHANGED
data/spec/condition_spec.rb
CHANGED
@@ -35,9 +35,14 @@ describe Condition do
|
|
35
35
|
ds = DB[:t_user].prepare(:insert, :insert_with_name, item.params.merge({user_id: :$user_id, user_name: :$user_name}))
|
36
36
|
ds.call(item.value.merge(param.get('ins', 0)))
|
37
37
|
|
38
|
-
list = DB["SELECT * FROM t_user"].all
|
38
|
+
list = DB["SELECT * FROM t_user order by user_id"].all
|
39
39
|
param.check('list', list)
|
40
|
-
param.check('list', [
|
40
|
+
param.check('list', [
|
41
|
+
{user_id: 1, user_name: "aaax"},
|
42
|
+
{user_id: 2, user_name: "bbbx"},
|
43
|
+
{user_id: 3, user_name: "cccx"},
|
44
|
+
{user_id: 4, user_name: "ddd"},
|
45
|
+
])
|
41
46
|
end
|
42
47
|
|
43
48
|
it 'ref and json' do
|
@@ -117,4 +122,24 @@ describe Condition do
|
|
117
122
|
Condition::Param.set_reader(nil)
|
118
123
|
expect { Condition::Param.new('files_aaa', reader: reader) }.to raise_error("redis key name files_aaa not found")
|
119
124
|
end
|
125
|
+
|
126
|
+
it 'output count' do
|
127
|
+
reader = Condition::Reader::RedisReader.new(REDIS)
|
128
|
+
Condition::Param.set_reader(nil)
|
129
|
+
param = Condition::Param.new('files_t_user_params', reader: reader)
|
130
|
+
|
131
|
+
param.check('output_count', [{l: [{id: "1"}, {id: "2"}, {id: "3"}]}])
|
132
|
+
expect { param.check('output_count', [{id: "1"}, {id: "2"}]) }.to raise_error
|
133
|
+
expect { param.check('output_count', [{id: "1"}, {id: "2"}, {id: "3"}, {id: "4"}]) }.to raise_error
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'options count' do
|
137
|
+
reader = Condition::Reader::RedisReader.new(REDIS)
|
138
|
+
Condition::Param.set_reader(nil)
|
139
|
+
param = Condition::Param.new('files_t_user_params', reader: reader)
|
140
|
+
|
141
|
+
item = param.item('options')
|
142
|
+
expect(item.options.length).to eq(4)
|
143
|
+
end
|
144
|
+
|
120
145
|
end
|
data/spec/files/t_user.ods
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: condition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aoyagikouhei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|