ruby-marc-spec 0.1.2 → 0.1.3
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/CHANGES.md +5 -0
- data/lib/marc/spec/module_info.rb +1 -1
- data/lib/marc/spec/queries/condition_context.rb +6 -11
- data/spec/marc/spec/queries/query_spec.rb +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf2331d16b9bc58bb638a8114e8e2cb752b5ed1fc328a2ed2a5bc12a0dcaf5d9
|
4
|
+
data.tar.gz: b77bbe6bfae6926f4771ad0c3ca91d4c037cf254880d6a89846c7ea13a2dd11a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f9ae89dcdb0249075a2bed9e605b2b7bb5dd906f0c907d1646fcaa6686c8198a6f0e154c9ebe1d2692c854d79c1082cb3a924bb33aa1c6406c03026ca65f63a
|
7
|
+
data.tar.gz: 1d408f4496ec3fb1221497d977716442ab35f799baa1d33109d1e5cd2b6af618b909a0f83db39b0bc2b74a3559672c3d54d596334679d815ed45bec3e9a455b7
|
data/CHANGES.md
CHANGED
@@ -7,7 +7,7 @@ module MARC
|
|
7
7
|
SUMMARY = 'MARCspec for Ruby'.freeze
|
8
8
|
DESCRIPTION = 'An implementation of the MARCspec query language for Ruby and ruby-marc'.freeze
|
9
9
|
LICENSE = 'MIT'.freeze
|
10
|
-
VERSION = '0.1.
|
10
|
+
VERSION = '0.1.3'.freeze
|
11
11
|
HOMEPAGE = 'https://github.com/BerkeleyLibrary/marc-spec'.freeze
|
12
12
|
end
|
13
13
|
end
|
@@ -15,7 +15,7 @@ module MARC
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def operand_value(operand, implicit: false)
|
18
|
-
return context_result if implicit && operand.nil?
|
18
|
+
return operand_value(context_result) if implicit && operand.nil?
|
19
19
|
|
20
20
|
raw_value = operand_value_raw(operand)
|
21
21
|
is_boolean = [true, false].include?(raw_value)
|
@@ -25,16 +25,11 @@ module MARC
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def operand_value_raw(operand)
|
28
|
-
return
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
when Condition
|
34
|
-
operand.met?(self)
|
35
|
-
when Query
|
36
|
-
operand.execute(executor, [context_field], context_result)
|
37
|
-
end
|
28
|
+
return operand.str_exact if operand.is_a?(ComparisonString)
|
29
|
+
return operand.met?(self) if operand.is_a?(Condition)
|
30
|
+
return operand.execute(executor, [context_field], context_result) if operand.is_a?(Query)
|
31
|
+
|
32
|
+
operand
|
38
33
|
end
|
39
34
|
|
40
35
|
def as_string(op_val)
|
@@ -208,9 +208,20 @@ module MARC::Spec
|
|
208
208
|
}
|
209
209
|
verify_all(examples)
|
210
210
|
end
|
211
|
+
|
212
|
+
it 'can check for substrings in subfield values' do
|
213
|
+
df260 = marc_record['260']
|
214
|
+
df260a = df260.subfields.find { |sf| sf.code == 'a' }
|
215
|
+
examples = {
|
216
|
+
'260{$a~\Diego}' => [df260],
|
217
|
+
'260$a{~\Diego}' => [df260a],
|
218
|
+
'260$a{~\Los\sAngeles}' => [],
|
219
|
+
'260{$a~\Los\sAngeles}' => []
|
220
|
+
}
|
221
|
+
verify_all(examples)
|
222
|
+
end
|
211
223
|
end
|
212
224
|
end
|
213
225
|
end
|
214
|
-
|
215
226
|
end
|
216
227
|
end
|