Class: Kindai::Spread
- Inherits:
-
Object
- Object
- Kindai::Spread
- Defined in:
- lib/kindai/spread.rb
Instance Attribute Summary collapse
-
#book ⇒ Object
Returns the value of attribute book.
-
#spread_number ⇒ Object
Returns the value of attribute spread_number.
Class Method Summary collapse
Instance Method Summary collapse
- #image_uri ⇒ Object
-
#page ⇒ Object
protected XXX: book use this.
- #uri ⇒ Object
Instance Attribute Details
#book ⇒ Object
Returns the value of attribute book.
4 5 6 |
# File 'lib/kindai/spread.rb', line 4 def book @book end |
#spread_number ⇒ Object
Returns the value of attribute spread_number.
5 6 7 |
# File 'lib/kindai/spread.rb', line 5 def spread_number @spread_number end |
Class Method Details
.new_from_book_and_spread_number(book, spread_number) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/kindai/spread.rb', line 7 def self.new_from_book_and_spread_number(book, spread_number) raise TypeError, "#{book} is not Kindai::Book" unless book.is_a? Kindai::Book me = new me.book = book me.spread_number = spread_number me end |
Instance Method Details
#image_uri ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/kindai/spread.rb', line 19 def image_uri params = { :itemId => "info:ndljp/pid/#{book.key}", :contentNo => spread_number, :outputScale => 1, } "http://kindai.ndl.go.jp/view/jpegOutput?" + Kindai::Util.(params) end |
#page ⇒ Object
protected XXX: book use this
30 31 32 |
# File 'lib/kindai/spread.rb', line 30 def page @page ||= Nokogiri Kindai::Util.fetch_uri self.uri end |
#uri ⇒ Object
15 16 17 |
# File 'lib/kindai/spread.rb', line 15 def uri "#{book.permalink_uri}/#{spread_number.to_s}" end |