Sha256: 27637b4566d0c8e39034600157d9b6c9dc87297647e478c651722b01f1880519
Contents?: true
Size: 779 Bytes
Versions: 3
Compression:
Stored size: 779 Bytes
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'pstore' module Bookscan class Cache < PStore def groups gs = nil transaction do |ps| gs = ps["groups"] end raise "No groups in cache. Exceute 'bookscan update' first." unless gs gs end def tuned ts = nil transaction do |ps| ts = ps["tuned"] end ts end def tuned?(book,type) tuned.has?(book.book_id) and tuned.by_id(book.book_id).tune_type == type end def books(group = nil) if group groups.each do |g| return g.books if g.hash == group.hash end else bs = Books.new groups.each do |g| bs += g.books end bs end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bookscan-0.2.2 | lib/bookscan/cache.rb |
bookscan-0.2.1 | lib/bookscan/cache.rb |
bookscan-0.2.0 | lib/bookscan/cache.rb |