Class: Gzlib::Book
- Inherits:
-
Object
- Object
- Gzlib::Book
- Defined in:
- lib/gzlib/book.rb
Constant Summary collapse
- Search =
'http://opac.gzlib.gov.cn/opac/book/holdingpreview/'
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#publisher ⇒ Object
readonly
Returns the value of attribute publisher.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(node) ⇒ Book
constructor
A new instance of Book.
- #positions ⇒ Object
Constructor Details
#initialize(node) ⇒ Book
Returns a new instance of Book.
10 11 12 13 14 15 16 17 |
# File 'lib/gzlib/book.rb', line 10 def initialize(node) @title = node.at_css('.bookmetaTitle').text.strip @id = node['bookrecno'] = node.css('div') = [1].at_css('a').text.strip @publisher = [2].at_css('a').text.strip @year = [2].text.gsub(/[^\d]/,'') end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
8 9 10 |
# File 'lib/gzlib/book.rb', line 8 def end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/gzlib/book.rb', line 8 def id @id end |
#publisher ⇒ Object (readonly)
Returns the value of attribute publisher.
8 9 10 |
# File 'lib/gzlib/book.rb', line 8 def publisher @publisher end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/gzlib/book.rb', line 8 def title @title end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
8 9 10 |
# File 'lib/gzlib/book.rb', line 8 def year @year end |
Instance Method Details
#positions ⇒ Object
19 20 21 |
# File 'lib/gzlib/book.rb', line 19 def positions @poss ||= Gzlib::Positions.new id end |