Class: AudioBookCreator::Web
- Inherits:
-
Object
- Object
- AudioBookCreator::Web
- Includes:
- Logging
- Defined in:
- lib/audio_book_creator/web.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Integer the number of pages visited.
-
#max ⇒ Object
Integer the maximum number of pages to visit.
Instance Method Summary collapse
- #[](url) ⇒ Object
-
#initialize(max = nil) ⇒ Web
constructor
A new instance of Web.
Methods included from Logging
Constructor Details
#initialize(max = nil) ⇒ Web
Returns a new instance of Web.
16 17 18 19 |
# File 'lib/audio_book_creator/web.rb', line 16 def initialize(max = nil) @max = max @count = 0 end |
Instance Attribute Details
#count ⇒ Object
Returns Integer the number of pages visited.
14 15 16 |
# File 'lib/audio_book_creator/web.rb', line 14 def count @count end |
#max ⇒ Object
Returns Integer the maximum number of pages to visit.
10 11 12 |
# File 'lib/audio_book_creator/web.rb', line 10 def max @max end |
Instance Method Details
#[](url) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/audio_book_creator/web.rb', line 21 def [](url) @count += 1 log_page(url) check_limit open(url.to_s).read end |