condition 0.0.8 → 0.0.9
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_item.rb +26 -2
- data/lib/condition/version.rb +1 -1
- data/spec/condition_spec.rb +1 -1
- 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: 9b30028c08d8586bbc2846e45107fd738ef3ab07
|
4
|
+
data.tar.gz: 3fc8ef2b4e14594112d6ef7ea54c7a04b86b9565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bad7d74c148c5567379a55ecd980f13a273c1de5cefcffb999da621e7caab942ee4a68d33eb1fda87f7ab421dac1cc0cabecf589626b207d8bd1a0c8be8f54e9
|
7
|
+
data.tar.gz: 2e1210d1cbc76d637b327d1191c05ab1ff690116ab6bae3bd19caef5c70a74d738a107b8116f63806fabf1cbbe95abed4925a24ae20c8971b88b9c0d96706317
|
data/README.md
CHANGED
data/lib/condition/param_item.rb
CHANGED
@@ -100,13 +100,37 @@ module Condition
|
|
100
100
|
elsif Hash === real
|
101
101
|
if !(Hash === expected)
|
102
102
|
false
|
103
|
+
elsif real == expected
|
104
|
+
true
|
105
|
+
else
|
106
|
+
result = true
|
107
|
+
expected.each_pair do |k, v|
|
108
|
+
res = value_match?(v, real[k])
|
109
|
+
result = false if !res
|
110
|
+
end
|
111
|
+
result
|
103
112
|
end
|
104
|
-
expected == real
|
105
113
|
elsif Array === real
|
106
114
|
if !(Array === expected)
|
107
115
|
false
|
116
|
+
elsif real.size() == 0 && expected.size() == 0
|
117
|
+
true
|
118
|
+
elsif real == expected
|
119
|
+
true
|
120
|
+
else
|
121
|
+
index = 0
|
122
|
+
result = true
|
123
|
+
while true
|
124
|
+
break if index >= expected.size
|
125
|
+
res = value_match?(expected[index], real[index])
|
126
|
+
if !res
|
127
|
+
result = false
|
128
|
+
break
|
129
|
+
end
|
130
|
+
index += 1
|
131
|
+
end
|
132
|
+
result
|
108
133
|
end
|
109
|
-
expected == real
|
110
134
|
else
|
111
135
|
real.to_s == expected
|
112
136
|
end
|
data/lib/condition/version.rb
CHANGED
data/spec/condition_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe Condition do
|
|
32
32
|
|
33
33
|
it 'ref and json' do
|
34
34
|
param = Condition::Param.new(FILES + '/t_user.ods', 2)
|
35
|
-
param.check('ary', [{name: "a", val1: {a: "b"}, val2: [{a: {c: "d"}}], val3: [], val4: nil, val5: {a: [1, 2, 3]}}])
|
35
|
+
param.check('ary', [{name: "a", val1: {a: "b", t: true, f: false}, val2: [{a: {c: "d"}}], val3: [], val4: nil, val5: {a: [1, 2, 3]}, val6: true, val7: false}])
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'unmatch' do
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aoyagikouhei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|