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) ⇒ ReadResult

Returns a new instance of ReadResult.



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

def initialize(content = nil)
  @content = content
  @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

#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



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

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