Module: Validatable::Requireable
- Included in:
- ValidationBase
- Defined in:
- lib/gems/validatable-1.6.7/lib/requireable.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
13 14 15 |
# File 'lib/gems/validatable-1.6.7/lib/requireable.rb', line 13 def self.included(klass) klass.extend ClassMethods end |
Instance Method Details
#requires(options) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/gems/validatable-1.6.7/lib/requireable.rb', line 17 def requires() = self.class..inject([]) do |errors, attribute| errors << attribute.to_s unless .has_key?(attribute) errors end raise ArgumentError.new("#{self.class} requires options: #{.join(', ')}") if .any? true end |