Sha256: 6706a99a85af234dcdb6fd812aaae0c60d70f4e32492feda124e3bae0986512e

Contents?: true

Size: 724 Bytes

Versions: 25

Compression:

Stored size: 724 Bytes

Contents

module Exlibris
  module Primo
    module WebService
      module Request
        module SortBys
          # 
          # Returns a lambda that takes a Nokogiri::XML::Builder as an argument
          # and appends sort bys XML to it.
          # 
          def sort_bys_xml
            lambda { |xml|
              xml.SortByList {
                sort_bys.each do |sort_by|
                  xml.SortField sort_by
                end
              } unless sort_bys.empty?
            }
          end
          protected :sort_bys_xml

          def sort_bys
            @sort_bys ||= []
          end

          def add_sort_by(sort_by)
            sort_bys << sort_by
          end
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
exlibris-primo-1.0.4 lib/exlibris/primo/web_service/request/search/sort_bys.rb
exlibris-primo-1.0.3 lib/exlibris/primo/web_service/request/search/sort_bys.rb
exlibris-primo-1.0.2 lib/exlibris/primo/web_service/request/search/sort_bys.rb
exlibris-primo-1.0.1 lib/exlibris/primo/web_service/request/search/sort_bys.rb
exlibris-primo-1.0.0 lib/exlibris/primo/web_service/request/search/sort_bys.rb