Module: Amp::Command::Validations

Included in:
Base
Defined in:
lib/amp-front/dispatch/commands/validations.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



18
19
20
# File 'lib/amp-front/dispatch/commands/validations.rb', line 18

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#invalid?(opts, args) ⇒ Boolean

Returns:

  • (Boolean)


162
163
164
# File 'lib/amp-front/dispatch/commands/validations.rb', line 162

def invalid?(opts, args)
  !valid?(opts, args)
end

#run_after(opts, args) ⇒ Object



166
167
168
# File 'lib/amp-front/dispatch/commands/validations.rb', line 166

def run_after(opts, args)
  self.class.after_blocks.all? {|block| block.call(opts, args)}
end

#valid?(opts, args) ⇒ Boolean Also known as: run_before

Is this a valid set of options and arguments for this command?

Returns:

  • (Boolean)


157
158
159
# File 'lib/amp-front/dispatch/commands/validations.rb', line 157

def valid?(opts, args)
  self.class.before_blocks.all? {|block| block.call(opts, args)}
end