Class: NcodeSyosetu::Model::Episode
- Inherits:
-
Object
- Object
- NcodeSyosetu::Model::Episode
- Defined in:
- lib/ncode_syosetu/model/episode.rb
Instance Attribute Summary collapse
-
#body_html ⇒ Object
Returns the value of attribute body_html.
-
#number ⇒ Object
Returns the value of attribute number.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(title, number, page) ⇒ Episode
constructor
A new instance of Episode.
Constructor Details
#initialize(title, number, page) ⇒ Episode
Returns a new instance of Episode.
8 9 10 11 12 13 14 15 16 |
# File 'lib/ncode_syosetu/model/episode.rb', line 8 def initialize(title, number, page) @url = page.uri.to_s @title = title @number = number @body_html = page.search(".novel_subtitle").to_html << page.search(".novel_view").to_html end |
Instance Attribute Details
#body_html ⇒ Object
Returns the value of attribute body_html.
6 7 8 |
# File 'lib/ncode_syosetu/model/episode.rb', line 6 def body_html @body_html end |
#number ⇒ Object
Returns the value of attribute number.
6 7 8 |
# File 'lib/ncode_syosetu/model/episode.rb', line 6 def number @number end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/ncode_syosetu/model/episode.rb', line 6 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/ncode_syosetu/model/episode.rb', line 6 def url @url end |
Instance Method Details
#html ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ncode_syosetu/model/episode.rb', line 18 def html <<-HTML <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>#{@title}</title> </head> <body> #{@body_html} </body> </html> HTML end |