Class: SiteChecker::IO::ContentFromFileSystem
- Inherits:
-
Object
- Object
- SiteChecker::IO::ContentFromFileSystem
- Defined in:
- lib/site_checker/io/content_from_file_system.rb
Instance Method Summary collapse
- #get(link) ⇒ Object
-
#initialize(visit_references, root) ⇒ ContentFromFileSystem
constructor
A new instance of ContentFromFileSystem.
Constructor Details
#initialize(visit_references, root) ⇒ ContentFromFileSystem
Returns a new instance of ContentFromFileSystem.
5 6 7 8 |
# File 'lib/site_checker/io/content_from_file_system.rb', line 5 def initialize(visit_references, root) @visit_references = visit_references @root = root end |
Instance Method Details
#get(link) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/site_checker/io/content_from_file_system.rb', line 10 def get(link) begin location = create_absolute_reference(link.url) if link.local_page? content = File.open(add_index_html(location)).read elsif link.local_image? File.open(location) elsif @visit_references open(link.url) end rescue Errno::ENOENT => e raise "(404 Not Found)" rescue => e raise "(#{e..strip})" end content end |