Class: Wayfarer::Routing::Matchers::Host

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EmptyParams

#params

Constructor Details

#initialize(host) ⇒ Host

Returns a new instance of Host.



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

def initialize(host)
  @host = host
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



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

def host
  @host
end

Instance Method Details

#evaluate(path_finder) ⇒ Object



15
16
17
18
19
# File 'lib/wayfarer/routing/matchers/host.rb', line 15

def evaluate(path_finder)
  # rubocop:disable Style/CaseEquality -- String and Regexp matching
  @host === path_finder.uri.host
  # rubocop:enable Style/CaseEquality
end

#to_hObject



21
22
23
# File 'lib/wayfarer/routing/matchers/host.rb', line 21

def to_h
  { name: host }
end