Class: SiteDiff::UriWrapper::ReadResult

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

Overview

This lets us treat errors or content as one object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content = nil, encoding = 'utf-8') ⇒ ReadResult

Returns a new instance of ReadResult.



23
24
25
26
27
28
# File 'lib/sitediff/uriwrapper.rb', line 23

def initialize(content = nil, encoding = 'utf-8')
  @content = content
  @encoding = encoding
  @error = nil
  @error_code = nil
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



21
22
23
# File 'lib/sitediff/uriwrapper.rb', line 21

def content
  @content
end

#encodingObject

Returns the value of attribute encoding.



21
22
23
# File 'lib/sitediff/uriwrapper.rb', line 21

def encoding
  @encoding
end

#errorObject

Returns the value of attribute error.



21
22
23
# File 'lib/sitediff/uriwrapper.rb', line 21

def error
  @error
end

#error_codeObject

Returns the value of attribute error_code.



21
22
23
# File 'lib/sitediff/uriwrapper.rb', line 21

def error_code
  @error_code
end

Class Method Details

.error(err, code = nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/sitediff/uriwrapper.rb', line 30

def self.error(err, code = nil)
  res = new
  res.error_code = code
  res.error = err
  res
end