Class: Wsv::PathResolver::Result
- Inherits:
-
Object
- Object
- Wsv::PathResolver::Result
- Defined in:
- lib/wsv/path_resolver.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
- #error? ⇒ Boolean
- #file? ⇒ Boolean
-
#initialize(kind:, status: nil, file: nil) ⇒ Result
constructor
A new instance of Result.
- #redirect? ⇒ Boolean
Constructor Details
#initialize(kind:, status: nil, file: nil) ⇒ Result
Returns a new instance of Result.
14 15 16 17 18 |
# File 'lib/wsv/path_resolver.rb', line 14 def initialize(kind:, status: nil, file: nil) @kind = kind @status = status @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
12 13 14 |
# File 'lib/wsv/path_resolver.rb', line 12 def file @file end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/wsv/path_resolver.rb', line 12 def status @status end |
Class Method Details
.error(status) ⇒ Object
40 41 42 |
# File 'lib/wsv/path_resolver.rb', line 40 def self.error(status) new(kind: :error, status: status) end |
.file(path) ⇒ Object
32 33 34 |
# File 'lib/wsv/path_resolver.rb', line 32 def self.file(path) new(kind: :file, status: 200, file: path) end |
.redirect ⇒ Object
36 37 38 |
# File 'lib/wsv/path_resolver.rb', line 36 def self.redirect new(kind: :redirect, status: 301) end |
Instance Method Details
#error? ⇒ Boolean
28 29 30 |
# File 'lib/wsv/path_resolver.rb', line 28 def error? @kind == :error end |
#file? ⇒ Boolean
20 21 22 |
# File 'lib/wsv/path_resolver.rb', line 20 def file? @kind == :file end |
#redirect? ⇒ Boolean
24 25 26 |
# File 'lib/wsv/path_resolver.rb', line 24 def redirect? @kind == :redirect end |