Class: Crawlscope::Page

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, normalized_url:, final_url:, normalized_final_url:, status:, headers:, body:, doc:, error: nil) ⇒ Page

Returns a new instance of Page.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/crawlscope/page.rb', line 7

def initialize(url:, normalized_url:, final_url:, normalized_final_url:, status:, headers:, body:, doc:, error: nil)
  @url = url
  @normalized_url = normalized_url
  @final_url = final_url
  @normalized_final_url = normalized_final_url
  @status = status
  @headers = headers || {}
  @body = body
  @doc = doc
  @error = error
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def body
  @body
end

#docObject (readonly)

Returns the value of attribute doc.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def doc
  @doc
end

#errorObject (readonly)

Returns the value of attribute error.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def error
  @error
end

#final_urlObject (readonly)

Returns the value of attribute final_url.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def final_url
  @final_url
end

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def headers
  @headers
end

#normalized_final_urlObject (readonly)

Returns the value of attribute normalized_final_url.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def normalized_final_url
  @normalized_final_url
end

#normalized_urlObject (readonly)

Returns the value of attribute normalized_url.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def normalized_url
  @normalized_url
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def status
  @status
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/crawlscope/page.rb', line 5

def url
  @url
end

Instance Method Details

#html?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/crawlscope/page.rb', line 19

def html?
  !doc.nil?
end