Class: PageCrawler
- Inherits:
-
Object
- Object
- PageCrawler
- Defined in:
- lib/yamd.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#chapter ⇒ Object
readonly
Returns the value of attribute chapter.
-
#custom_data ⇒ Object
readonly
Returns the value of attribute custom_data.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#parsed_html ⇒ Object
readonly
Returns the value of attribute parsed_html.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #clean_image_url ⇒ Object
- #image_url ⇒ Object
-
#initialize(custom_data, parsed_html, number, chapter) ⇒ PageCrawler
constructor
A new instance of PageCrawler.
Constructor Details
#initialize(custom_data, parsed_html, number, chapter) ⇒ PageCrawler
Returns a new instance of PageCrawler.
46 47 48 49 50 51 52 53 |
# File 'lib/yamd.rb', line 46 def initialize(custom_data, parsed_html, number, chapter) @custom_data = custom_data @url = custom_data[:url] @uri = Addressable::URI.heuristic_parse(url) @parsed_html = parsed_html @number = number @chapter = chapter end |
Instance Attribute Details
#chapter ⇒ Object (readonly)
Returns the value of attribute chapter.
44 45 46 |
# File 'lib/yamd.rb', line 44 def chapter @chapter end |
#custom_data ⇒ Object (readonly)
Returns the value of attribute custom_data.
44 45 46 |
# File 'lib/yamd.rb', line 44 def custom_data @custom_data end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
44 45 46 |
# File 'lib/yamd.rb', line 44 def number @number end |
#parsed_html ⇒ Object (readonly)
Returns the value of attribute parsed_html.
44 45 46 |
# File 'lib/yamd.rb', line 44 def parsed_html @parsed_html end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
44 45 46 |
# File 'lib/yamd.rb', line 44 def uri @uri end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
44 45 46 |
# File 'lib/yamd.rb', line 44 def url @url end |
Instance Method Details
#clean_image_url ⇒ Object
59 60 61 |
# File 'lib/yamd.rb', line 59 def clean_image_url @uri.join(image_url).normalize.to_s end |
#image_url ⇒ Object
55 56 57 |
# File 'lib/yamd.rb', line 55 def image_url fail 'This method is abstract and have to be defined in a subclass.' end |