auto_ar 0.0.1 → 0.0.2
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.tar.gz.sig +2 -4
- data/Rakefile +1 -1
- data/auto_ar.gemspec +4 -4
- data/lib/auto_ar.rb +4 -10
- data/test/auto_ar_test.rb +1 -1
- metadata +19 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Z~�������$v\P�
|
|
4
|
-
[���+��x@��O9��9L�q?��
|
|
1
|
+
�,k�y5Y�@�;)�����XV�ќ�H-0}��(�/ʢT8彎rU"r��
|
|
2
|
+
�¯�N�ҕX<\�:�5ZO3�;h��T��Ȅ�4����&|�h�5��+�r<Q���!�ޛ6
|
data/Rakefile
CHANGED
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
|
2
2
|
require 'rake'
|
|
3
3
|
require 'echoe'
|
|
4
4
|
|
|
5
|
-
Echoe.new('auto_ar', '0.0.
|
|
5
|
+
Echoe.new('auto_ar', '0.0.2') do |p|
|
|
6
6
|
p.description = "A gem that makes ActiveRecord subclasses on the fly"
|
|
7
7
|
p.url = "http://github.com/tmaeda/auto_ar"
|
|
8
8
|
p.author = "Tomoki MAEDA"
|
data/auto_ar.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{auto_ar}
|
|
5
|
-
s.version = "0.0.
|
|
5
|
+
s.version = "0.0.2"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Tomoki MAEDA"]
|
|
@@ -13,10 +13,10 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.extra_rdoc_files = ["lib/auto_ar.rb"]
|
|
14
14
|
s.files = ["Manifest", "Rakefile", "lib/auto_ar.rb", "test/auto_ar_test.rb", "test/test_helper.rb", "auto_ar.gemspec"]
|
|
15
15
|
s.homepage = %q{http://github.com/tmaeda/auto_ar}
|
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Auto_ar"]
|
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Auto_ar", "--main", "README"]
|
|
17
17
|
s.require_paths = ["lib"]
|
|
18
18
|
s.rubyforge_project = %q{auto_ar}
|
|
19
|
-
s.rubygems_version = %q{1.3.
|
|
19
|
+
s.rubygems_version = %q{1.3.7}
|
|
20
20
|
s.signing_key = %q{/home/tmaeda/.gemcert/gem-private_key.pem}
|
|
21
21
|
s.summary = %q{A gem that makes ActiveRecord subclasses on the fly}
|
|
22
22
|
s.test_files = ["test/auto_ar_test.rb", "test/test_helper.rb"]
|
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
26
26
|
s.specification_version = 3
|
|
27
27
|
|
|
28
|
-
if Gem::Version.new(Gem::
|
|
28
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
29
29
|
else
|
|
30
30
|
end
|
|
31
31
|
else
|
data/lib/auto_ar.rb
CHANGED
|
@@ -28,7 +28,7 @@ if defined?(ActiveRecord::Base)
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
module
|
|
31
|
+
module AutoARReflection
|
|
32
32
|
def self.included(base)
|
|
33
33
|
base.class_eval do
|
|
34
34
|
unless defined? method_missing_without_auto_ar
|
|
@@ -46,9 +46,8 @@ if defined?(ActiveRecord::Base)
|
|
|
46
46
|
f_key = method_name.singularize.foreign_key
|
|
47
47
|
if self.respond_to?(f_key)
|
|
48
48
|
target_klass = Object.const_get(method_name.classify)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
foo(target_klass, self.class)
|
|
49
|
+
target_klass.class_eval("has_many :#{self.class.to_s.pluralize.underscore.intern}")
|
|
50
|
+
self.class.class_eval("belongs_to :#{method_sym}")
|
|
52
51
|
else
|
|
53
52
|
raise NoMethodError
|
|
54
53
|
end
|
|
@@ -70,14 +69,9 @@ if defined?(ActiveRecord::Base)
|
|
|
70
69
|
self.send(method_sym, *args)
|
|
71
70
|
end
|
|
72
71
|
end
|
|
73
|
-
|
|
74
|
-
def foo(parent_class, child_class)
|
|
75
|
-
parent_class.class_eval("has_many :#{child_class.to_s.pluralize.underscore}")
|
|
76
|
-
child_class.class_eval("belongs_to :#{parent_class.to_s.singularize.underscore}")
|
|
77
|
-
end
|
|
78
72
|
end
|
|
79
73
|
Module.instance_eval{ include AutoAR }
|
|
80
|
-
ActiveRecord::Base.instance_eval{ include
|
|
74
|
+
ActiveRecord::Base.instance_eval{ include AutoARReflection }
|
|
81
75
|
else
|
|
82
76
|
raise "Error: ActiveRecord required."
|
|
83
77
|
end
|
data/test/auto_ar_test.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auto_ar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 27
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.0.2
|
|
5
11
|
platform: ruby
|
|
6
12
|
authors:
|
|
7
13
|
- Tomoki MAEDA
|
|
@@ -59,24 +65,33 @@ rdoc_options:
|
|
|
59
65
|
- --inline-source
|
|
60
66
|
- --title
|
|
61
67
|
- Auto_ar
|
|
68
|
+
- --main
|
|
69
|
+
- README
|
|
62
70
|
require_paths:
|
|
63
71
|
- lib
|
|
64
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
65
74
|
requirements:
|
|
66
75
|
- - ">="
|
|
67
76
|
- !ruby/object:Gem::Version
|
|
77
|
+
hash: 3
|
|
78
|
+
segments:
|
|
79
|
+
- 0
|
|
68
80
|
version: "0"
|
|
69
|
-
version:
|
|
70
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
|
+
none: false
|
|
71
83
|
requirements:
|
|
72
84
|
- - ">="
|
|
73
85
|
- !ruby/object:Gem::Version
|
|
86
|
+
hash: 11
|
|
87
|
+
segments:
|
|
88
|
+
- 1
|
|
89
|
+
- 2
|
|
74
90
|
version: "1.2"
|
|
75
|
-
version:
|
|
76
91
|
requirements: []
|
|
77
92
|
|
|
78
93
|
rubyforge_project: auto_ar
|
|
79
|
-
rubygems_version: 1.3.
|
|
94
|
+
rubygems_version: 1.3.7
|
|
80
95
|
signing_key:
|
|
81
96
|
specification_version: 3
|
|
82
97
|
summary: A gem that makes ActiveRecord subclasses on the fly
|
metadata.gz.sig
CHANGED
|
Binary file
|