Class: Rage::Router::Strategies::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/rage/router/strategies/host.rb

Defined Under Namespace

Classes: HostStorage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHost

Returns a new instance of Host.



6
7
8
9
# File 'lib/rage/router/strategies/host.rb', line 6

def initialize
  @name = "host"
  @must_match_when_derived = false
end

Instance Attribute Details

#must_match_when_derivedObject (readonly)

Returns the value of attribute must_match_when_derived.



4
5
6
# File 'lib/rage/router/strategies/host.rb', line 4

def must_match_when_derived
  @must_match_when_derived
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/rage/router/strategies/host.rb', line 4

def name
  @name
end

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rage/router/strategies/host.rb', line 15

def custom?
  false
end

#storageObject



11
12
13
# File 'lib/rage/router/strategies/host.rb', line 11

def storage
  HostStorage.new
end

#validate(value) ⇒ Object



19
20
21
22
23
# File 'lib/rage/router/strategies/host.rb', line 19

def validate(value)
  if !value.is_a?(String) && !value.is_a?(Regexp)
    raise "Host should be a string or a Regexp"
  end
end