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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7c07c75f4d7301b6a165724f8753630010c0df3b468b81c2debcc6ad38fb4d1
4
- data.tar.gz: 36e1a57d33df1a5fe2553ec3fce562e08e58d2664c55262a644eeb49fecad4e4
3
+ metadata.gz: bf2331d16b9bc58bb638a8114e8e2cb752b5ed1fc328a2ed2a5bc12a0dcaf5d9
4
+ data.tar.gz: b77bbe6bfae6926f4771ad0c3ca91d4c037cf254880d6a89846c7ea13a2dd11a
5
5
  SHA512:
6
- metadata.gz: b08b4c373d701cf2e0a2e43c45fbb7081893f257437e7b8e6e6c4583e0cf4440869b3e25f0f31006f2c8be8a63953468ec39af8c94d9a03dc6bb1ccedbc4baef
7
- data.tar.gz: b49627593b4e74361e443f4536145cc365d3ace763f87ee312263a968b65002f1696c389b14fc45376ac168950ae3293746f0435723080c98b51a26029931094
6
+ metadata.gz: 2f9ae89dcdb0249075a2bed9e605b2b7bb5dd906f0c907d1646fcaa6686c8198a6f0e154c9ebe1d2692c854d79c1082cb3a924bb33aa1c6406c03026ca65f63a
7
+ data.tar.gz: 1d408f4496ec3fb1221497d977716442ab35f799baa1d33109d1e5cd2b6af618b909a0f83db39b0bc2b74a3559672c3d54d596334679d815ed45bec3e9a455b7
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.1.3 (2022-02-02)
2
+
3
+ - Fix issue where applying subspecs against a subfield value as an implicit
4
+ left-hand subterm would produce `NoMethodError`.
5
+
1
6
  # 0.1.2 (2022-02-01)
2
7
 
3
8
  - Adds `MARC::Spec#exists?` to check if a MARC record has data matching a
@@ -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.2'.freeze
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 unless operand
29
-
30
- case operand
31
- when ComparisonString
32
- operand.str_exact
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-marc-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles