Class: Flame::Validators::ArgumentsValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/flame/validators.rb

Overview

Compare arguments from path and from controller’s action

Instance Method Summary collapse

Constructor Details

#initialize(ctrl, path, action) ⇒ ArgumentsValidator

Returns a new instance of ArgumentsValidator.



7
8
9
10
11
# File 'lib/flame/validators.rb', line 7

def initialize(ctrl, path, action)
	@ctrl = ctrl
	@path = path
	@action = action
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
# File 'lib/flame/validators.rb', line 13

def valid?
	## Break path for ':arg' arguments
	@path_args = path_arguments(@path)
	## Take all and required arguments from Controller#action
	@action_args = action_arguments(@action)
	## Compare arguments from path and arguments from method
	no_extra_path_arguments? && no_extra_action_arguments?
end