lib/marc_extensions/subfield.rb in berkeley_library-marc-0.2.1 vs lib/marc_extensions/subfield.rb in berkeley_library-marc-0.3.0

- old
+ new

@@ -1,20 +1,28 @@ require 'marc' module MARCExtensions + # Extensions to [MARC::Subfield](https://rubydoc.info/gems/marc/MARC/Subfield). module SubfieldExtensions + + # Recursively freezes this subfield, including its code and value. + # + # @return [Boolean] true if this subfield is frozen, false otherwise def frozen? - [code, value].all?(&:frozen?) + [code, value].all?(&:frozen?) && super end + # Whether this subfield and its code and value are frozen. + # @return [MARC::Subfield] this subfield. def freeze [code, value].each(&:freeze) - self + super end end end module MARC + # Applies the extensions in {MARCExtensions::SubfieldExtensions}. # @see https://rubydoc.info/gems/marc/MARC/Subfield RubyGems documentation class Subfield prepend MARCExtensions::SubfieldExtensions end end