Class: LinkChecker::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-link-checker/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_uri, method, original_uri, options = {}) ⇒ Result

Returns a new instance of Result.



5
6
7
8
9
10
# File 'lib/ruby-link-checker/result.rb', line 5

def initialize(current_uri, method, original_uri, options = {})
  @uri = original_uri
  @result_uri = current_uri
  @method = method
  @options = options
end

Instance Attribute Details

#checkerObject

Returns the value of attribute checker.



3
4
5
# File 'lib/ruby-link-checker/result.rb', line 3

def checker
  @checker
end

#methodObject

Returns the value of attribute method.



3
4
5
# File 'lib/ruby-link-checker/result.rb', line 3

def method
  @method
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/ruby-link-checker/result.rb', line 3

def options
  @options
end

#result_uriObject

Returns the value of attribute result_uri.



3
4
5
# File 'lib/ruby-link-checker/result.rb', line 3

def result_uri
  @result_uri
end

#uriObject

Returns the value of attribute uri.



3
4
5
# File 'lib/ruby-link-checker/result.rb', line 3

def uri
  @uri
end

Instance Method Details

#codeObject



36
37
38
# File 'lib/ruby-link-checker/result.rb', line 36

def code
  nil
end

#errorObject



40
41
42
# File 'lib/ruby-link-checker/result.rb', line 40

def error
  nil
end

#error?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ruby-link-checker/result.rb', line 20

def error?
  false
end

#failure?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ruby-link-checker/result.rb', line 16

def failure?
  false
end

#redirect?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ruby-link-checker/result.rb', line 24

def redirect?
  false
end

#redirect_toObject



28
29
30
# File 'lib/ruby-link-checker/result.rb', line 28

def redirect_to
  nil
end

#request_headersObject



32
33
34
# File 'lib/ruby-link-checker/result.rb', line 32

def request_headers
  {}
end

#success?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ruby-link-checker/result.rb', line 12

def success?
  false
end

#to_sObject



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ruby-link-checker/result.rb', line 44

def to_s
  status_s = if success?
               'OK'
             elsif failure?
               'FAIL'
             elsif redirect?
               'REDIRECT'
             else
               'ERROR'
             end
  "#{method} #{uri}#{result_uri == uri ? nil : ' (' + result_uri.to_s + ')'}: #{status_s} (#{code})"
end