Class: MissionControl::Web::RoutesCache

Inherits:
Object
  • Object
show all
Defined in:
lib/mission_control/web/routes_cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ RoutesCache

Returns a new instance of RoutesCache.



4
5
6
# File 'lib/mission_control/web/routes_cache.rb', line 4

def initialize(application)
  @application = application
end

Instance Method Details

#disabled?(path) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/mission_control/web/routes_cache.rb', line 20

def disabled?(path)
  all_disabled_patterns.any? { |pattern| Regexp.new(pattern) =~ path }
end

#put(route) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/mission_control/web/routes_cache.rb', line 8

def put(route)
  remove(route)

  if route.disabled?
    add(route)
  end
end

#remove(route) ⇒ Object



16
17
18
# File 'lib/mission_control/web/routes_cache.rb', line 16

def remove(route)
  redis.srem redis_key, [ route.pattern_previously_was.to_s, route.pattern.to_s ]
end