Class: Flame::ActionsValidator
- Inherits:
-
Object
- Object
- Flame::ActionsValidator
- Defined in:
- lib/flame/validators.rb
Overview
Compare actions from routes and from controller
Instance Method Summary collapse
-
#initialize(route_refine) ⇒ ActionsValidator
constructor
A new instance of ActionsValidator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(route_refine) ⇒ ActionsValidator
Returns a new instance of ActionsValidator.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/flame/validators.rb', line 60 def initialize(route_refine) @routes_actions = route_refine.routes.map { |route| route[:action] } @hooks_actions = route_refine.hooks.values.map(&:values).flatten @hooks_actions.select! { |action| action.is_a? Symbol } @ctrl = route_refine.ctrl @ctrl_actions = { public: @ctrl.public_instance_methods(false), all: @ctrl.instance_methods + @ctrl.private_instance_methods } end |
Instance Method Details
#valid? ⇒ Boolean
71 72 73 74 75 |
# File 'lib/flame/validators.rb', line 71 def valid? no_extra_routes_actions? && no_extra_hooks_actions? && no_extra_controller_actions? end |