Class: Wayfarer::Routing::Matchers::Scheme

Inherits:
Object
  • Object
show all
Includes:
EmptyParams
Defined in:
lib/wayfarer/routing/matchers/scheme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EmptyParams

#params

Constructor Details

#initialize(scheme) ⇒ Scheme

Returns a new instance of Scheme.



11
12
13
# File 'lib/wayfarer/routing/matchers/scheme.rb', line 11

def initialize(scheme)
  @scheme = scheme
end

Instance Attribute Details

#schemeObject (readonly)

Returns the value of attribute scheme.



9
10
11
# File 'lib/wayfarer/routing/matchers/scheme.rb', line 9

def scheme
  @scheme
end

Instance Method Details

#evaluate(path_finder) ⇒ Object



15
16
17
# File 'lib/wayfarer/routing/matchers/scheme.rb', line 15

def evaluate(path_finder)
  path_finder.uri.scheme == scheme.to_s
end

#to_hObject



19
20
21
# File 'lib/wayfarer/routing/matchers/scheme.rb', line 19

def to_h
  { scheme: scheme }
end