Class: AudioBookCreator::Web

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/audio_book_creator/web.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#logger

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

#countObject

Returns Integer the number of pages visited.

Returns:

  • Integer the number of pages visited



14
15
16
# File 'lib/audio_book_creator/web.rb', line 14

def count
  @count
end

#maxObject

Returns Integer the maximum number of pages to visit.

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