Class: NcodeSyosetu::Model::Episode

Inherits:
Object
  • Object
show all
Defined in:
lib/ncode_syosetu/model/episode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_htmlObject

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

#numberObject

Returns the value of attribute number.



6
7
8
# File 'lib/ncode_syosetu/model/episode.rb', line 6

def number
  @number
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/ncode_syosetu/model/episode.rb', line 6

def title
  @title
end

#urlObject

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

#htmlObject



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
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ja\" lang=\"ja\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n<title>\#{@title}</title>\n</head>\n<body>\n\n\#{@body_html}\n\n</body>\n</html>\n  HTML\nend\n"