Class: Bookbinder::Postprocessing::BrokenLinksChecker
- Inherits:
-
Object
- Object
- Bookbinder::Postprocessing::BrokenLinksChecker
- Defined in:
- lib/bookbinder/postprocessing/broken_links_checker.rb
Class Method Summary collapse
Instance Method Summary collapse
- #announce(streams) ⇒ Object
- #check!(broken_link_exclusions) ⇒ Object
- #has_broken_links? ⇒ Boolean
-
#initialize(spider, server_director) ⇒ BrokenLinksChecker
constructor
A new instance of BrokenLinksChecker.
Constructor Details
#initialize(spider, server_director) ⇒ BrokenLinksChecker
Returns a new instance of BrokenLinksChecker.
19 20 21 22 |
# File 'lib/bookbinder/postprocessing/broken_links_checker.rb', line 19 def initialize(spider, server_director) @spider = spider @server_director = server_director end |
Class Method Details
.build(final_app_directory, port) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bookbinder/postprocessing/broken_links_checker.rb', line 8 def self.build(final_app_directory, port) new( Spider.new(app_dir: final_app_directory), ServerDirector.new( app: RackApp.new(Pathname('redirects.rb'), auth_required: false).app, directory: final_app_directory, port: port ) ) end |
Instance Method Details
#announce(streams) ⇒ Object
30 31 32 |
# File 'lib/bookbinder/postprocessing/broken_links_checker.rb', line 30 def announce(streams) @result.announce_broken_links(streams) end |
#check!(broken_link_exclusions) ⇒ Object
24 25 26 27 28 |
# File 'lib/bookbinder/postprocessing/broken_links_checker.rb', line 24 def check!(broken_link_exclusions) server_director.use_server { |port| @result = spider.find_broken_links(port, broken_link_exclusions: broken_link_exclusions) } end |
#has_broken_links? ⇒ Boolean
34 35 36 |
# File 'lib/bookbinder/postprocessing/broken_links_checker.rb', line 34 def has_broken_links? @result.has_broken_links? end |