module MARC::Spec::Queries::PositionOrRange

Marker interface for positions and ranges TODO: unify Position and AlNumRange?

Protected Instance Methods

wrap_array_result(result) click to toggle source

NOTE: We can’t use ‘Array()` because we don’t want to indiscriminately call ‘to_ary` / `to_a`

# File lib/marc/spec/queries/position_or_range.rb, line 18
def wrap_array_result(result)
  return [] unless result
  return result if result.is_a?(Array)

  [result]
end
wrap_string_result(result) click to toggle source
# File lib/marc/spec/queries/position_or_range.rb, line 13
def wrap_string_result(result)
  result unless result.nil? || result.empty?
end