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.



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

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#statusObject (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

.redirectObject



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

Returns:

  • (Boolean)


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

def error?
  @kind == :error
end

#file?Boolean

Returns:

  • (Boolean)


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

def file?
  @kind == :file
end

#redirect?Boolean

Returns:

  • (Boolean)


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

def redirect?
  @kind == :redirect
end