Class: Flipper::Api::ActionCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/flipper/api/action_collection.rb

Overview

Internal: Used to detect the action that should be used in the middleware.

Instance Method Summary collapse

Constructor Details

#initializeActionCollection

Returns a new instance of ActionCollection.



5
6
7
# File 'lib/flipper/api/action_collection.rb', line 5

def initialize
  @action_classes = []
end

Instance Method Details

#action_for_request(request) ⇒ Object



13
14
15
16
17
# File 'lib/flipper/api/action_collection.rb', line 13

def action_for_request(request)
  @action_classes.detect do |action_class|
    action_class.route_match?(request.path_info)
  end
end

#add(action_class) ⇒ Object



9
10
11
# File 'lib/flipper/api/action_collection.rb', line 9

def add(action_class)
  @action_classes << action_class
end