Class: Wsv::PathResolver::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/wsv/path_resolver.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, status: nil, file: nil) ⇒ Result

Returns a new instance of Result.



10
11
12
13
14
# File 'lib/wsv/path_resolver.rb', line 10

def initialize(kind:, status: nil, file: nil)
  @kind = kind
  @status = status
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



8
9
10
# File 'lib/wsv/path_resolver.rb', line 8

def file
  @file
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/wsv/path_resolver.rb', line 8

def status
  @status
end

Class Method Details

.error(status) ⇒ Object



36
37
38
# File 'lib/wsv/path_resolver.rb', line 36

def self.error(status)
  new(kind: :error, status: status)
end

.file(path) ⇒ Object



28
29
30
# File 'lib/wsv/path_resolver.rb', line 28

def self.file(path)
  new(kind: :file, status: 200, file: path)
end

.redirectObject



32
33
34
# File 'lib/wsv/path_resolver.rb', line 32

def self.redirect
  new(kind: :redirect, status: 301)
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/wsv/path_resolver.rb', line 24

def error?
  @kind == :error
end

#file?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/wsv/path_resolver.rb', line 16

def file?
  @kind == :file
end

#redirect?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/wsv/path_resolver.rb', line 20

def redirect?
  @kind == :redirect
end