Class: Linkey::CheckResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/linkey.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#baseObject

Returns the value of attribute base.



13
14
15
# File 'lib/linkey.rb', line 13

def base
  @base
end

#file_nameObject

Returns the value of attribute file_name.



13
14
15
# File 'lib/linkey.rb', line 13

def file_name
  @file_name
end

#regObject

Returns the value of attribute reg.



13
14
15
# File 'lib/linkey.rb', line 13

def reg
  @reg
end

#urlObject

Returns the value of attribute url.



13
14
15
# File 'lib/linkey.rb', line 13

def url
  @url
end

Instance Method Details



22
23
24
25
# File 'lib/linkey.rb', line 22

def check_links
  links_list = File.read(file_name).split(",")
  links(links_list)
end


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