condition 0.0.27 → 0.0.28
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 +3 -0
- data/lib/condition/param.rb +6 -2
- data/lib/condition/param_item.rb +6 -4
- data/lib/condition/version.rb +1 -1
- data/spec/condition_spec.rb +29 -3
- data/spec/files/t_user.ods +0 -0
- 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: 5a71ca9f6eeadb13b4693a1225abb81daf9aac06
|
4
|
+
data.tar.gz: 5c5bc5b440e4df1144986b9ed14a86a12c66e9fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f034d5dae5c0b284d232fb5d28c54e8b5e5a192401f36f796f96570c8bda4db2390e24438cf5930803f7d9324292b4557a7c1715440bd75c95f3ac7bace0e591
|
7
|
+
data.tar.gz: c8b61d6e3da820a82aa467607ba15f8f78fc50126d0c5e5b0e2b4df07b5d00a51ca30336dc8d4dbb889db6011bbbdb555ce72d633ed7fe24ed24537792eba0fc
|
data/README.md
CHANGED
data/lib/condition/param.rb
CHANGED
@@ -52,8 +52,10 @@ module Condition
|
|
52
52
|
item = item(name)
|
53
53
|
raise "#{name} not found in param" if item.nil?
|
54
54
|
item.clear_used_values
|
55
|
+
index = 0
|
55
56
|
data.each do |line|
|
56
|
-
item.check_line(line)
|
57
|
+
item.check_line(line, index)
|
58
|
+
index += 1
|
57
59
|
end
|
58
60
|
raise "#{item.name} not exists row" if item.is_remain_value
|
59
61
|
end
|
@@ -70,8 +72,10 @@ module Condition
|
|
70
72
|
@item_map.each_value do |item|
|
71
73
|
item.clear_used_values
|
72
74
|
list = storage.all(item)
|
75
|
+
index = 0
|
73
76
|
list.each do |line|
|
74
|
-
item.check_line(line)
|
77
|
+
item.check_line(line, index)
|
78
|
+
index += 1
|
75
79
|
end
|
76
80
|
raise "#{item.name} not exists row" if item.is_remain_value
|
77
81
|
end
|
data/lib/condition/param_item.rb
CHANGED
@@ -158,8 +158,7 @@ module Condition
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
def check_value(real, value)
|
162
|
-
targetFlag = true
|
161
|
+
def check_value(real, value, targetFlag)
|
163
162
|
matchFlag = true
|
164
163
|
@unmatch_info = []
|
165
164
|
value.each_pair do |k, v|
|
@@ -179,9 +178,12 @@ module Condition
|
|
179
178
|
end
|
180
179
|
end
|
181
180
|
|
182
|
-
def check_line(real)
|
181
|
+
def check_line(real, index)
|
182
|
+
value_index = 0
|
183
183
|
@values.each do |value|
|
184
|
-
|
184
|
+
targetFlag = @options.empty? ? value_index == index : true
|
185
|
+
return if check_value(real, value, targetFlag)
|
186
|
+
value_index += 1
|
185
187
|
end
|
186
188
|
raise "#{@name} not found " + real.to_s
|
187
189
|
end
|
data/lib/condition/version.rb
CHANGED
data/spec/condition_spec.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
describe Condition do
|
3
3
|
before(:all) do
|
4
|
-
DB << "DROP TABLE IF EXISTS t_user"
|
5
|
-
DB << "DROP TABLE IF EXISTS t_test"
|
4
|
+
DB << "DROP TABLE IF EXISTS t_user CASCADE"
|
5
|
+
DB << "DROP TABLE IF EXISTS t_test CASCADE"
|
6
6
|
DB << "CREATE TABLE t_user(user_id BIGINT, user_name TEXT, login_ts TIMESTAMPTZ NOT NULL)"
|
7
7
|
DB << "CREATE TABLE t_test(id BIGINT, name TEXT, flag BOOLEAN, ts TIMESTAMPTZ, iary BIGINT[], tary TEXT[], test_name TEXT NOT NULL)"
|
8
8
|
DB << "CREATE SCHEMA IF NOT EXISTS history"
|
9
|
-
DB << "DROP TABLE IF EXISTS history.t_user"
|
9
|
+
DB << "DROP TABLE IF EXISTS history.t_user CASCADE"
|
10
10
|
DB << "CREATE TABLE history.t_user(user_id BIGINT, user_name TEXT, login_ts TIMESTAMPTZ NOT NULL)"
|
11
11
|
|
12
12
|
converter = Condition::Reader::ConvertSheet.new(REDIS)
|
@@ -170,4 +170,30 @@ describe Condition do
|
|
170
170
|
expect { param.check('notexistsname', [{}]) }.to raise_error("notexistsname not found in param")
|
171
171
|
end
|
172
172
|
|
173
|
+
it 'many options' do
|
174
|
+
param = Condition::Param.new(FILES + '/t_user.ods', 2)
|
175
|
+
param.check('output_options', [
|
176
|
+
{val1: "2", val2: "2", val3: "z"},
|
177
|
+
{val1: "1", val2: "1", val3: "w"},
|
178
|
+
{val1: "1", val2: "2", val3: "x"},
|
179
|
+
{val1: "2", val2: "1", val3: "y"},
|
180
|
+
])
|
181
|
+
param.check('output_options2', [
|
182
|
+
{val1: "1", val2: "2", val3: "z"},
|
183
|
+
{val1: "1", val2: "2", val3: "w"},
|
184
|
+
{val1: "1", val2: "2", val3: "x"},
|
185
|
+
{val1: "1", val2: "2", val3: "y"},
|
186
|
+
])
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'output order' do
|
190
|
+
param = Condition::Param.new(FILES + '/t_user.ods', 2)
|
191
|
+
param.check('output_order', [
|
192
|
+
{val1: "1", val2: "4"},
|
193
|
+
{val1: "1", val2: "3"},
|
194
|
+
{val1: "1", val2: "2"},
|
195
|
+
{val1: "1", val2: "1"},
|
196
|
+
])
|
197
|
+
end
|
198
|
+
|
173
199
|
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.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aoyagikouhei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
200
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.2.
|
201
|
+
rubygems_version: 2.2.2
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: Condition Test
|