class Bookscan::Group
Attributes
books[RW]
date[R]
hash[R]
num[R]
payment[R]
price[R]
Public Class Methods
new()
click to toggle source
# File lib/bookscan/group.rb, line 9 def initialize @books = Books.new end
Public Instance Methods
completed?()
click to toggle source
# File lib/bookscan/group.rb, line 48 def completed? @is_completed end
import(tr)
click to toggle source
# File lib/bookscan/group.rb, line 28 def import(tr) a = Array.new tr.search("td").each do |td| a << td.text.to_s end if /hash=(.+)/ =~ tr.at("a/@href") @hash = $1 end # puts url @date = a[0] @num = a[1] @price = a[2] @payment = a[3] @is_completed = true if a[6] == "未完了" @is_completed = false end end
to_a()
click to toggle source
# File lib/bookscan/group.rb, line 13 def to_a if completed? @status = "完了" else @status = "未完了" end [@hash,@date,@num,@price,@payment,@status].collect { |i| i.force_encoding("utf-8") if i.respond_to?(:force_encoding) } end
url()
click to toggle source
# File lib/bookscan/group.rb, line 24 def url "/bookdetail.php?hash=" + @hash end