Class: Linkey::CheckResponse
- Inherits:
-
Object
- Object
- Linkey::CheckResponse
- Defined in:
- lib/linkey.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#reg ⇒ Object
Returns the value of attribute reg.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #check_links ⇒ Object
-
#initialize(url, base, reg, file_name) ⇒ CheckResponse
constructor
A new instance of CheckResponse.
- #links(links) ⇒ Object
- #scan(page_links) ⇒ Object
Constructor Details
#initialize(url, base, reg, file_name) ⇒ CheckResponse
Returns a new instance of CheckResponse.
15 16 17 18 19 20 |
# File 'lib/linkey.rb', line 15 def initialize(url, base, reg, file_name) @url = url @base = base @reg = reg @file_name = file_name end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
13 14 15 |
# File 'lib/linkey.rb', line 13 def base @base end |
#file_name ⇒ Object
Returns the value of attribute file_name.
13 14 15 |
# File 'lib/linkey.rb', line 13 def file_name @file_name end |
#reg ⇒ Object
Returns the value of attribute reg.
13 14 15 |
# File 'lib/linkey.rb', line 13 def reg @reg end |
#url ⇒ Object
Returns the value of attribute url.
13 14 15 |
# File 'lib/linkey.rb', line 13 def url @url end |
Instance Method Details
#check_links ⇒ Object
22 23 24 25 |
# File 'lib/linkey.rb', line 22 def check_links links_list = File.read(file_name).split(",") links(links_list) end |
#links(links) ⇒ Object
27 28 29 30 31 |
# File 'lib/linkey.rb', line 27 def links(links) links.each do |url_links| scan(url_links) end end |
#scan(page_links) ⇒ Object
33 34 35 36 |
# File 'lib/linkey.rb', line 33 def scan(page_links) urls = page_links.scan(/^#{Regexp.quote(reg)}(?:|.+)?$/) Getter.status(urls, base) end |