Class: Wayfarer::Routing::HostRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/wayfarer/routing/host_rule.rb

Instance Attribute Summary

Attributes inherited from Rule

#child_rules, #target_action

Instance Method Summary collapse

Methods inherited from Rule

#build_child_rule_chain_from_options, #filetypes, #host, #if, #invoke, #matches?, #matching_rule_chain, #params, #path, #protocol, #query, #uri

Constructor Details

#initialize(str_or_regexp, opts = {}, &proc) ⇒ HostRule

Returns a new instance of HostRule.


7
8
9
10
# File 'lib/wayfarer/routing/host_rule.rb', line 7

def initialize(str_or_regexp, opts = {}, &proc)
  @str_or_regexp = str_or_regexp
  super(opts, &proc)
end

Instance Method Details

#match!(uri) ⇒ Object

rubocop:disable Style/CaseEquality


13
14
15
# File 'lib/wayfarer/routing/host_rule.rb', line 13

def match!(uri)
  @str_or_regexp === uri.host
end