validation_reflection-active_model 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Brian Cardarella
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,7 @@
1
+ # validation_reflection-active_model
2
+
3
+ ActiveModel::Validations Interface for [validation_reflection](http://github.com/redinger/validation_reflection) and ActiveRecord 2.x
4
+
5
+ ## Copyright
6
+
7
+ Copyright (c) 2010 Brian Cardarella. See LICENSE for details.
@@ -0,0 +1,39 @@
1
+ require 'validation_reflection'
2
+
3
+ module ValidationReflection
4
+ module ActiveModelInterface
5
+
6
+ module InstanceMethods
7
+ def _validators
8
+ self.class._validators
9
+ end
10
+ end
11
+
12
+ module ClassMethods
13
+ def _validators
14
+ validations = Hash.new { |h, k| h[k] = [] }
15
+
16
+ reflect_on_all_validations.each do |reflection|
17
+ validations[reflection.name.to_sym] << reflection
18
+ end
19
+
20
+ validations
21
+ end
22
+ end
23
+ end
24
+
25
+ module MacroReflection
26
+ def kind
27
+ self.macro.to_s.match(/\w+_(\w+)_\w+/)[1].to_sym
28
+ end
29
+ end
30
+ end
31
+
32
+ ActiveRecord::Base.class_eval do
33
+ include ValidationReflection::ActiveModelInterface::InstanceMethods
34
+ extend ValidationReflection::ActiveModelInterface::ClassMethods
35
+ end
36
+
37
+ ActiveRecord::Reflection::MacroReflection.class_eval do
38
+ include ValidationReflection::MacroReflection
39
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: validation_reflection-active_model
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Brian Cardarella
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-15 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: validation_reflection
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 3
30
+ - 7
31
+ version: 0.3.7
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: ActiveModel Interface for validation_reflection
35
+ email: bcardarella@gmail.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - LICENSE
42
+ - README.markdown
43
+ files:
44
+ - LICENSE
45
+ - README.markdown
46
+ - lib/validation_reflection/active_model.rb
47
+ has_rdoc: true
48
+ homepage: http://github.com/bcardarella/validation_reflection-active_model
49
+ licenses: []
50
+
51
+ post_install_message:
52
+ rdoc_options:
53
+ - --charset=UTF-8
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ requirements: []
71
+
72
+ rubyforge_project:
73
+ rubygems_version: 1.3.6
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: ActiveModel Interface for validation_reflection
77
+ test_files: []
78
+