module Gzlib
Constants
- VERSION
Public Class Methods
list(*para)
click to toggle source
# File lib/gzlib.rb, line 10 def list(*para) style search(*para) end
search(*para)
click to toggle source
# File lib/gzlib.rb, line 6 def search(*para) Search.new(*para) end
Private Class Methods
book_style(book)
click to toggle source
# File lib/gzlib.rb, line 22 def book_style book "#{book.title} #{book.author}\n#{book.publisher} #{book.year}\n#{position_style book.positions}" end
position_style(poss)
click to toggle source
# File lib/gzlib.rb, line 26 def position_style poss free = poss. reject(&:loan?). group_by(&:lib_callno). map{|callno_lib, poss| [callno_lib, "free x #{poss.count}"]} loan = poss. select(&:loan?). sort_by(&:returnDate). map{|pos| [pos.lib_callno, pos.returnDate]} (free + loan).map{|status| status.join(' ')}.join("\n") end
style(search)
click to toggle source
# File lib/gzlib.rb, line 16 def style search search.first(10).map do |book| book_style book end.join "\n\n" end