Class: Flame::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.



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

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

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


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

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