Module: Thor::Validations::ClassMethods

Defined in:
lib/thor/validations.rb

Instance Method Summary collapse

Instance Method Details

#validate_before(*method_names, &validation) ⇒ Object



18
19
20
21
22
23
# File 'lib/thor/validations.rb', line 18

def validate_before(*method_names, &validation)
  method_names.each do |method_name|
    validations[method_name.to_sym] ||= []
    validations[method_name.to_sym] << validation
  end
end

#validationsObject



14
15
16
# File 'lib/thor/validations.rb', line 14

def validations
  @validations ||= {}
end