Class: Walle::Robot::Router::Route::Prefix

Inherits:
Mutator
  • Object
show all
Defined in:
lib/walle/robot/router/route.rb

Instance Attribute Summary

Attributes inherited from Mutator

#env, #options, #regexp

Instance Method Summary collapse

Methods inherited from Mutator

#initialize

Constructor Details

This class inherits a constructor from Walle::Robot::Router::Route::Mutator

Instance Method Details

#mutateObject



19
20
21
22
23
24
25
26
27
# File 'lib/walle/robot/router/route.rb', line 19

def mutate
  return regexp unless prefix

  if regexp
    Regexp.new("#{prefix}#{regexp.source}")
  else
    Regexp.new(prefix)
  end
end

#prefixObject



29
30
31
32
# File 'lib/walle/robot/router/route.rb', line 29

def prefix
  return if options[:prefix] === false
  options[:prefix] || '.*'
end