mongomatic 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/lib/mongomatic/base.rb +1 -1
  2. data/lib/mongomatic/validatable/child_validation.rb +17 -0
  3. data/lib/mongomatic/validatable/errors.rb +108 -0
  4. data/lib/mongomatic/validatable/included_validation.rb +11 -0
  5. data/lib/mongomatic/validatable/macros.rb +316 -0
  6. data/lib/{validatable → mongomatic/validatable}/object_extension.rb +0 -0
  7. data/lib/mongomatic/validatable/requireable.rb +28 -0
  8. data/lib/mongomatic/validatable/understandable.rb +33 -0
  9. data/lib/mongomatic/validatable/validatable_class_methods.rb +89 -0
  10. data/lib/mongomatic/validatable/validatable_instance_methods.rb +108 -0
  11. data/lib/mongomatic/validatable/validations/validates_acceptance_of.rb +16 -0
  12. data/lib/mongomatic/validatable/validations/validates_associated.rb +15 -0
  13. data/lib/mongomatic/validatable/validations/validates_confirmation_of.rb +25 -0
  14. data/lib/mongomatic/validatable/validations/validates_each.rb +16 -0
  15. data/lib/mongomatic/validatable/validations/validates_exclusion_of.rb +19 -0
  16. data/lib/mongomatic/validatable/validations/validates_format_of.rb +18 -0
  17. data/lib/mongomatic/validatable/validations/validates_inclusion_of.rb +19 -0
  18. data/lib/mongomatic/validatable/validations/validates_length_of.rb +32 -0
  19. data/lib/mongomatic/validatable/validations/validates_numericality_of.rb +28 -0
  20. data/lib/mongomatic/validatable/validations/validates_presence_of.rb +18 -0
  21. data/lib/mongomatic/validatable/validations/validates_true_for.rb +15 -0
  22. data/lib/mongomatic/validatable/validations/validation_base.rb +93 -0
  23. data/lib/{validatable.rb → mongomatic/validatable.rb} +4 -2
  24. data/lib/mongomatic.rb +1 -1
  25. metadata +26 -35
  26. data/lib/validatable/child_validation.rb +0 -15
  27. data/lib/validatable/errors.rb +0 -106
  28. data/lib/validatable/included_validation.rb +0 -9
  29. data/lib/validatable/macros.rb +0 -314
  30. data/lib/validatable/requireable.rb +0 -26
  31. data/lib/validatable/understandable.rb +0 -31
  32. data/lib/validatable/validatable_class_methods.rb +0 -87
  33. data/lib/validatable/validatable_instance_methods.rb +0 -106
  34. data/lib/validatable/validations/validates_acceptance_of.rb +0 -14
  35. data/lib/validatable/validations/validates_associated.rb +0 -13
  36. data/lib/validatable/validations/validates_confirmation_of.rb +0 -23
  37. data/lib/validatable/validations/validates_each.rb +0 -14
  38. data/lib/validatable/validations/validates_exclusion_of.rb +0 -17
  39. data/lib/validatable/validations/validates_format_of.rb +0 -16
  40. data/lib/validatable/validations/validates_inclusion_of.rb +0 -17
  41. data/lib/validatable/validations/validates_length_of.rb +0 -30
  42. data/lib/validatable/validations/validates_numericality_of.rb +0 -27
  43. data/lib/validatable/validations/validates_presence_of.rb +0 -17
  44. data/lib/validatable/validations/validates_true_for.rb +0 -13
  45. data/lib/validatable/validations/validation_base.rb +0 -91
@@ -0,0 +1,108 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ def self.included(klass) #:nodoc:
4
+ klass.extend Validatable::ClassMethods
5
+ klass.extend Validatable::Macros
6
+ end
7
+
8
+ # call-seq: valid?
9
+ #
10
+ # Returns true if no errors were added otherwise false. Only executes validations that have no :groups option specified
11
+ def valid?
12
+ valid_for_group?(nil)
13
+ end
14
+
15
+ # call-seq: errors
16
+ #
17
+ # Returns the Errors object that holds all information about attribute error messages.
18
+ def errors
19
+ @errors ||= Validatable::Errors.new
20
+ end
21
+
22
+ def valid_for_group?(group) #:nodoc:
23
+ errors.clear
24
+ run_before_validations
25
+ self.class.validate_children(self, group)
26
+ self.validate_group(group)
27
+ errors.empty?
28
+ end
29
+
30
+ def times_validated(key) #:nodoc:
31
+ times_validated_hash[key] || 0
32
+ end
33
+
34
+ def increment_times_validated_for(validation) #:nodoc:
35
+ if validation.key != nil
36
+ if times_validated_hash[validation.key].nil?
37
+ times_validated_hash[validation.key] = 1
38
+ else
39
+ times_validated_hash[validation.key] += 1
40
+ end
41
+ end
42
+ end
43
+
44
+ # call-seq: validate_only(key)
45
+ #
46
+ # Only executes a specified validation. The argument should follow a pattern based on the key of the validation.
47
+ # Examples:
48
+ # * validates_presence_of :name can be run with obj.validate_only("presence_of/name")
49
+ # * validates_presence_of :birthday, :key => "a key" can be run with obj.validate_only("presence_of/a key")
50
+ def validate_only(key)
51
+ validation_name, attribute_name = key.split("/")
52
+ validation_name = validation_name.split("_").collect{|word| word.capitalize}.join
53
+ validation_key = "#{self.class.name}/Validatable::Validates#{validation_name}/#{attribute_name}"
54
+ validation = self.class.all_validations.find { |validation| validation.key == validation_key }
55
+ raise ArgumentError.new("validation with key #{validation_key} could not be found") if validation.nil?
56
+ errors.clear
57
+ run_validation(validation)
58
+ end
59
+
60
+ protected
61
+ def times_validated_hash #:nodoc:
62
+ @times_validated_hash ||= {}
63
+ end
64
+
65
+ def validate_group(group) #:nodoc:
66
+ validation_levels.each do |level|
67
+ validations_for_level_and_group(level, group).each do |validation|
68
+ run_validation(validation) if validation.should_validate?(self)
69
+ end
70
+ return unless self.errors.empty?
71
+ end
72
+ end
73
+
74
+ def run_validation(validation) #:nodoc:
75
+ validation_result = validation.valid?(self)
76
+ add_error(validation.attribute, validation.message(self)) unless validation_result
77
+ increment_times_validated_for(validation)
78
+ validation.run_after_validate(validation_result, self, validation.attribute)
79
+ end
80
+
81
+ def run_before_validations #:nodoc:
82
+ self.class.all_before_validations.each do |block|
83
+ instance_eval &block
84
+ end
85
+ end
86
+
87
+ def add_error(attribute, message) #:nodoc:
88
+ self.class.add_error(self, attribute, message)
89
+ end
90
+
91
+ def validations_for_level_and_group(level, group) #:nodoc:
92
+ validations_for_level = self.all_validations.select { |validation| validation.level == level }
93
+ return validations_for_level.select { |validation| validation.groups.empty? } if group.nil?
94
+ validations_for_level.select { |validation| validation.groups.include?(group) }
95
+ end
96
+
97
+ def all_validations #:nodoc:
98
+ res = self.class.validations_to_include.inject(self.class.all_validations) do |result, included_validation_class|
99
+ result += self.send(included_validation_class.attribute).all_validations
100
+ result
101
+ end
102
+ end
103
+
104
+ def validation_levels #:nodoc:
105
+ self.class.all_validations.inject([1]) { |result, validation| result << validation.level }.uniq.sort
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,16 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesAcceptanceOf < ValidationBase #:nodoc:
4
+ def valid?(instance)
5
+ value = instance[self.attribute.to_s]
6
+ return true if allow_nil && value.nil?
7
+ return true if allow_blank && value.blank?
8
+ %w(1 true t).include?(value)
9
+ end
10
+
11
+ def message(instance)
12
+ super || "must be accepted"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesAssociated < ValidationBase #:nodoc:
4
+ def valid?(instance)
5
+ Array(instance.send(attribute)).compact.map do |child|
6
+ child.valid?
7
+ end.all?
8
+ end
9
+
10
+ def message(instance)
11
+ super || "is invalid"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesConfirmationOf < ValidationBase #:nodoc:
4
+ option :case_sensitive
5
+ default :case_sensitive => true
6
+
7
+ def initialize(klass, attribute, options={})
8
+ klass.class_eval { attr_accessor "#{attribute}_confirmation" }
9
+ super
10
+ end
11
+
12
+ def valid?(instance)
13
+ confirmation_value = instance.send("#{self.attribute}_confirmation")
14
+ return true if allow_nil && confirmation_value.nil?
15
+ return true if allow_blank && confirmation_value.blank?
16
+ return instance[self.attribute.to_s] == instance.send("#{self.attribute}_confirmation".to_sym) if case_sensitive
17
+ instance[self.attribute.to_s].to_s.casecmp(instance.send("#{self.attribute}_confirmation".to_sym).to_s) == 0
18
+ end
19
+
20
+ def message(instance)
21
+ super || "doesn't match confirmation"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesEach < ValidationBase #:nodoc:
4
+ required_option :logic
5
+
6
+ def valid?(instance)
7
+ instance.instance_eval(&logic)
8
+ true # return true so no error is added. should look in the future at doing this different.
9
+ end
10
+
11
+ def message(instance)
12
+ super || "is invalid"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesExclusionOf < ValidationBase #:nodoc:
4
+ required_option :within
5
+
6
+ def valid?(instance)
7
+ value = instance.send(attribute)
8
+ return true if allow_nil && value.nil?
9
+ return true if allow_blank && value.blank?
10
+
11
+ !within.include?(value)
12
+ end
13
+
14
+ def message(instance)
15
+ super || "is reserved"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesFormatOf < ValidationBase #:nodoc:
4
+ required_option :with
5
+
6
+ def valid?(instance)
7
+ value = instance[self.attribute.to_s]
8
+ return true if allow_nil && value.nil?
9
+ return true if allow_blank && value.blank?
10
+ not (value.to_s =~ self.with).nil?
11
+ end
12
+
13
+ def message(instance)
14
+ super || "is invalid"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesInclusionOf < ValidationBase
4
+ required_option :within
5
+
6
+ def valid?(instance)
7
+ value = instance.send(attribute)
8
+ return true if allow_nil && value.nil?
9
+ return true if allow_blank && value.blank?
10
+
11
+ within.include?(value)
12
+ end
13
+
14
+ def message(instance)
15
+ super || "is not in the list"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesLengthOf < ValidationBase #:nodoc:
4
+ option :minimum, :maximum, :is, :within
5
+
6
+ def message(instance)
7
+ super || "is invalid"
8
+ end
9
+
10
+ def valid?(instance)
11
+ valid = true
12
+ value = instance[self.attribute.to_s]
13
+
14
+ if value.nil?
15
+ return true if allow_nil
16
+ value = ''
17
+ end
18
+
19
+ if value.blank?
20
+ return true if allow_blank
21
+ value = ''
22
+ end
23
+
24
+ valid &&= value.length <= maximum unless maximum.nil?
25
+ valid &&= value.length >= minimum unless minimum.nil?
26
+ valid &&= value.length == is unless is.nil?
27
+ valid &&= within.include?(value.length) unless within.nil?
28
+ valid
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesNumericalityOf < ValidationBase #:nodoc:
4
+ option :only_integer
5
+
6
+ def valid?(instance)
7
+ value = value_for(instance)
8
+ return true if allow_nil && value.nil?
9
+ return true if allow_blank && value.blank?
10
+
11
+ value = value.to_s
12
+ regex = self.only_integer ? /\A[+-]?\d+\Z/ : /^\d*\.{0,1}\d+$/
13
+ not (value =~ regex).nil?
14
+ end
15
+
16
+ def message(instance)
17
+ super || "must be a number"
18
+ end
19
+
20
+ private
21
+ def value_for(instance)
22
+ before_typecast_method = "#{self.attribute}_before_typecast"
23
+ value_method = instance.respond_to?(before_typecast_method.intern) ? before_typecast_method : self.attribute
24
+ instance.send(value_method)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesPresenceOf < ValidationBase #:nodoc:
4
+ def valid?(instance)
5
+ value = instance[self.attribute.to_s]
6
+ return true if allow_nil && value.nil?
7
+ return true if allow_blank && value.blank?
8
+
9
+ return false if instance[self.attribute.to_s].nil?
10
+ value.respond_to?(:strip) ? instance[self.attribute.to_s].strip.length != 0 : true
11
+ end
12
+
13
+ def message(instance)
14
+ super || "can't be empty"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidatesTrueFor < ValidationBase #:nodoc:
4
+ required_option :logic
5
+
6
+ def valid?(instance)
7
+ instance.instance_eval(&logic) == true
8
+ end
9
+
10
+ def message(instance)
11
+ super || "is invalid"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,93 @@
1
+ module Mongomatic
2
+ module Validatable
3
+ class ValidationBase #:nodoc:
4
+ def self.required_option(*args)
5
+ option(*args)
6
+ requires(*args)
7
+ end
8
+
9
+ def self.option(*args)
10
+ attr_accessor(*args)
11
+ understands(*args)
12
+ end
13
+
14
+ def self.default(hash)
15
+ defaults.merge! hash
16
+ end
17
+
18
+ def self.defaults
19
+ @defaults ||= {}
20
+ end
21
+
22
+ def self.all_defaults
23
+ return defaults.merge(self.superclass.all_defaults) if self.superclass.respond_to? :all_defaults
24
+ defaults
25
+ end
26
+
27
+ def self.after_validate(&block)
28
+ after_validations << block
29
+ end
30
+
31
+ def self.after_validations
32
+ @after_validations ||= []
33
+ end
34
+
35
+ def self.all_after_validations
36
+ return after_validations + self.superclass.all_after_validations if self.superclass.respond_to? :all_after_validations
37
+ after_validations
38
+ end
39
+
40
+ include Understandable
41
+ include Requireable
42
+
43
+ option :message, :if, :times, :level, :groups, :key, :after_validate, :allow_nil, :allow_blank
44
+ default :level => 1, :groups => []
45
+ attr_accessor :attribute
46
+
47
+ def initialize(klass, attribute, options={})
48
+ must_understand options
49
+ requires options
50
+ self.class.all_understandings.each do |understanding|
51
+ options[understanding] = self.class.all_defaults[understanding] unless options.has_key? understanding
52
+ self.instance_variable_set("@#{understanding}", options[understanding])
53
+ end
54
+ self.attribute = attribute
55
+ self.groups = [self.groups] unless self.groups.is_a?(Array)
56
+ self.key = "#{klass.name}/#{self.class.name}/#{self.key || self.attribute}"
57
+ raise_error_if_key_is_dup(klass)
58
+ end
59
+
60
+ def raise_error_if_key_is_dup(klass)
61
+ message = "key #{self.key} must be unique, provide the :key option to specify a unique key"
62
+ raise ArgumentError.new(message) if klass.validation_keys_include? self.key
63
+ end
64
+
65
+ def should_validate?(instance)
66
+ result = validate_this_time?(instance)
67
+ case self.if
68
+ when Proc
69
+ result &&= instance.instance_eval(&self.if)
70
+ when Symbol, String
71
+ result &&= instance.instance_eval(self.if.to_s)
72
+ end
73
+ result
74
+ end
75
+
76
+ def message(instance)
77
+ @message.respond_to?(:call) ? instance.instance_eval(&@message) : @message
78
+ end
79
+
80
+ def validate_this_time?(instance)
81
+ return true if @times.nil?
82
+ self.times > instance.times_validated(self.key)
83
+ end
84
+
85
+ def run_after_validate(result, instance, attribute)
86
+ self.class.all_after_validations.each do |block|
87
+ block.call result, instance, attribute
88
+ end
89
+ instance.instance_eval_with_params result, attribute, &self.after_validate unless self.after_validate.nil?
90
+ end
91
+ end
92
+ end
93
+ end
@@ -24,6 +24,8 @@ require "#{File.dirname(__FILE__)}/validatable/validations/validates_inclusion_o
24
24
  require "#{File.dirname(__FILE__)}/validatable/validations/validates_each"
25
25
  require "#{File.dirname(__FILE__)}/validatable/validations/validates_associated"
26
26
 
27
- module Validatable
28
- Version = "1.8.4"
27
+ module Mongomatic
28
+ module Validatable
29
+ Version = "1.8.4"
30
+ end
29
31
  end
data/lib/mongomatic.rb CHANGED
@@ -27,7 +27,7 @@ module Mongomatic
27
27
  end
28
28
  end
29
29
 
30
- require "#{File.dirname(__FILE__)}/validatable"
30
+ require "#{File.dirname(__FILE__)}/mongomatic/validatable"
31
31
 
32
32
  require "#{File.dirname(__FILE__)}/mongomatic/cursor"
33
33
  require "#{File.dirname(__FILE__)}/mongomatic/modifiers"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Myles
@@ -14,14 +14,13 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-07 00:00:00 -07:00
17
+ date: 2010-07-08 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: shoulda
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - ">="
27
26
  - !ruby/object:Gem::Version
@@ -36,7 +35,6 @@ dependencies:
36
35
  name: bson
37
36
  prerelease: false
38
37
  requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
38
  requirements:
41
39
  - - "="
42
40
  - !ruby/object:Gem::Version
@@ -51,7 +49,6 @@ dependencies:
51
49
  name: bson_ext
52
50
  prerelease: false
53
51
  requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
52
  requirements:
56
53
  - - "="
57
54
  - !ruby/object:Gem::Version
@@ -66,7 +63,6 @@ dependencies:
66
63
  name: mongo
67
64
  prerelease: false
68
65
  requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
66
  requirements:
71
67
  - - "="
72
68
  - !ruby/object:Gem::Version
@@ -81,7 +77,6 @@ dependencies:
81
77
  name: activesupport
82
78
  prerelease: false
83
79
  requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
80
  requirements:
86
81
  - - ">="
87
82
  - !ruby/object:Gem::Version
@@ -106,32 +101,30 @@ files:
106
101
  - lib/mongomatic/base.rb
107
102
  - lib/mongomatic/cursor.rb
108
103
  - lib/mongomatic/modifiers.rb
109
- - lib/validatable.rb
110
- - lib/validatable/child_validation.rb
111
- - lib/validatable/errors.rb
112
- - lib/validatable/included_validation.rb
113
- - lib/validatable/macros.rb
114
- - lib/validatable/object_extension.rb
115
- - lib/validatable/requireable.rb
116
- - lib/validatable/understandable.rb
117
- - lib/validatable/validatable_class_methods.rb
118
- - lib/validatable/validatable_instance_methods.rb
119
- - lib/validatable/validations/validates_acceptance_of.rb
120
- - lib/validatable/validations/validates_associated.rb
121
- - lib/validatable/validations/validates_confirmation_of.rb
122
- - lib/validatable/validations/validates_each.rb
123
- - lib/validatable/validations/validates_exclusion_of.rb
124
- - lib/validatable/validations/validates_format_of.rb
125
- - lib/validatable/validations/validates_inclusion_of.rb
126
- - lib/validatable/validations/validates_length_of.rb
127
- - lib/validatable/validations/validates_numericality_of.rb
128
- - lib/validatable/validations/validates_presence_of.rb
129
- - lib/validatable/validations/validates_true_for.rb
130
- - lib/validatable/validations/validation_base.rb
104
+ - lib/mongomatic/validatable.rb
105
+ - lib/mongomatic/validatable/child_validation.rb
106
+ - lib/mongomatic/validatable/errors.rb
107
+ - lib/mongomatic/validatable/included_validation.rb
108
+ - lib/mongomatic/validatable/macros.rb
109
+ - lib/mongomatic/validatable/object_extension.rb
110
+ - lib/mongomatic/validatable/requireable.rb
111
+ - lib/mongomatic/validatable/understandable.rb
112
+ - lib/mongomatic/validatable/validatable_class_methods.rb
113
+ - lib/mongomatic/validatable/validatable_instance_methods.rb
114
+ - lib/mongomatic/validatable/validations/validates_acceptance_of.rb
115
+ - lib/mongomatic/validatable/validations/validates_associated.rb
116
+ - lib/mongomatic/validatable/validations/validates_confirmation_of.rb
117
+ - lib/mongomatic/validatable/validations/validates_each.rb
118
+ - lib/mongomatic/validatable/validations/validates_exclusion_of.rb
119
+ - lib/mongomatic/validatable/validations/validates_format_of.rb
120
+ - lib/mongomatic/validatable/validations/validates_inclusion_of.rb
121
+ - lib/mongomatic/validatable/validations/validates_length_of.rb
122
+ - lib/mongomatic/validatable/validations/validates_numericality_of.rb
123
+ - lib/mongomatic/validatable/validations/validates_presence_of.rb
124
+ - lib/mongomatic/validatable/validations/validates_true_for.rb
125
+ - lib/mongomatic/validatable/validations/validation_base.rb
131
126
  - LICENSE
132
127
  - README.rdoc
133
- - test/helper.rb
134
- - test/test_meta_mongo.rb
135
128
  has_rdoc: true
136
129
  homepage: http://github.com/benmyles/mongomatic
137
130
  licenses: []
@@ -142,7 +135,6 @@ rdoc_options:
142
135
  require_paths:
143
136
  - lib
144
137
  required_ruby_version: !ruby/object:Gem::Requirement
145
- none: false
146
138
  requirements:
147
139
  - - ">="
148
140
  - !ruby/object:Gem::Version
@@ -150,7 +142,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
142
  - 0
151
143
  version: "0"
152
144
  required_rubygems_version: !ruby/object:Gem::Requirement
153
- none: false
154
145
  requirements:
155
146
  - - ">="
156
147
  - !ruby/object:Gem::Version
@@ -160,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
151
  requirements: []
161
152
 
162
153
  rubyforge_project:
163
- rubygems_version: 1.3.7
154
+ rubygems_version: 1.3.6
164
155
  signing_key:
165
156
  specification_version: 3
166
157
  summary: Mongomatic is a simple Ruby object mapper for Mongo
@@ -1,15 +0,0 @@
1
- module Validatable
2
- class ChildValidation #:nodoc:
3
- attr_accessor :attribute, :map, :should_validate_proc
4
-
5
- def initialize(attribute, map, should_validate_proc)
6
- @attribute = attribute
7
- @map = map
8
- @should_validate_proc = should_validate_proc
9
- end
10
-
11
- def should_validate?(instance)
12
- instance.instance_eval &should_validate_proc
13
- end
14
- end
15
- end