Class: SiteDiff::UriWrapper::ReadResult
- Inherits:
-
Object
- Object
- SiteDiff::UriWrapper::ReadResult
- Defined in:
- lib/sitediff/uriwrapper.rb
Overview
This lets us treat errors or content as one object
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#error ⇒ Object
Returns the value of attribute error.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
Class Method Summary collapse
-
.error(message, code = nil) ⇒ Object
Creates a ReadResult with an error.
Instance Method Summary collapse
-
#initialize(content = nil, encoding = 'utf-8') ⇒ ReadResult
constructor
Creates a ReadResult.
Constructor Details
#initialize(content = nil, encoding = 'utf-8') ⇒ ReadResult
Creates a ReadResult.
32 33 34 35 36 37 |
# File 'lib/sitediff/uriwrapper.rb', line 32 def initialize(content = nil, encoding = 'utf-8') @content = content @encoding = encoding @error = nil @error_code = nil end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
28 29 30 |
# File 'lib/sitediff/uriwrapper.rb', line 28 def content @content end |
#encoding ⇒ Object
Returns the value of attribute encoding.
28 29 30 |
# File 'lib/sitediff/uriwrapper.rb', line 28 def encoding @encoding end |
#error ⇒ Object
Returns the value of attribute error.
28 29 30 |
# File 'lib/sitediff/uriwrapper.rb', line 28 def error @error end |
#error_code ⇒ Object
Returns the value of attribute error_code.
28 29 30 |
# File 'lib/sitediff/uriwrapper.rb', line 28 def error_code @error_code end |
Class Method Details
.error(message, code = nil) ⇒ Object
Creates a ReadResult with an error.
41 42 43 44 45 46 |
# File 'lib/sitediff/uriwrapper.rb', line 41 def self.error(, code = nil) res = new res.error_code = code res.error = res end |