Sha256: 18d56abf5294e625bdb667d1f6989ea0a39f668a6c7553ff72466ec6191c32b8

Contents?: true

Size: 638 Bytes

Versions: 4

Compression:

Stored size: 638 Bytes

Contents

require 'marc/spec/queries/applicable'

module MARC
  module Spec
    module Queries
      # Marker interface for positions and ranges
      # TODO: unify Position and AlNumRange?
      module PositionOrRange
        include Part

        protected

        def wrap_string_result(result)
          result unless result.nil? || result.empty?
        end

        # NOTE: We can't use `Array()` because we don't want to indiscriminately call `to_ary` / `to_a`
        def wrap_array_result(result)
          return [] unless result
          return result if result.is_a?(Array)

          [result]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-marc-spec-0.1.3 lib/marc/spec/queries/position_or_range.rb
ruby-marc-spec-0.1.2 lib/marc/spec/queries/position_or_range.rb
ruby-marc-spec-0.1.1 lib/marc/spec/queries/position_or_range.rb
ruby-marc-spec-0.1.0 lib/marc/spec/queries/position_or_range.rb