classy-inheritance 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -0
- data/lib/classy-inheritance.rb +6 -4
- data/lib/classy-inheritance/version.rb +2 -2
- data/website/index.html +13 -4
- data/website/index.txt +8 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
== 0.3.0 2008-06-12
|
2
|
+
* Add: :prefix parameter to depends_on call. So if you have User.depends_on(:profile, :attrs => [:first_name], :prefix => true), your user model will have @user.profile_first_name. This is to avoid name collisions with requisite classes.
|
1
3
|
== 0.2.1 2008-06-09
|
2
4
|
* Add: exposed :can_be method. Can now define what the polymorphic class can be with these methods. This will add the "is_a_<model>?" and "as_a_<model>" methods.
|
3
5
|
* Add: respond_to? :can_be test before adding to requisite class
|
data/lib/classy-inheritance.rb
CHANGED
@@ -39,7 +39,7 @@ module Stonean
|
|
39
39
|
define_can_be_method_on_requisite_class(model_sym, options[:as])
|
40
40
|
end
|
41
41
|
|
42
|
-
options[:attrs].each{|attr| define_accessors(model_sym, attr)}
|
42
|
+
options[:attrs].each{|attr| define_accessors(model_sym, attr, options[:prefix])}
|
43
43
|
end
|
44
44
|
|
45
45
|
|
@@ -103,12 +103,14 @@ module Stonean
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
def define_accessors(model_sym, attr)
|
107
|
-
|
106
|
+
def define_accessors(model_sym, attr, prefix)
|
107
|
+
accessor_method_name = ( prefix ? "#{model_sym}_#{attr}" : attr)
|
108
|
+
|
109
|
+
define_method accessor_method_name do
|
108
110
|
eval("self.#{model_sym} ? self.#{model_sym}.#{attr} : nil")
|
109
111
|
end
|
110
112
|
|
111
|
-
define_method "#{
|
113
|
+
define_method "#{accessor_method_name}=" do |val|
|
112
114
|
model_defined = eval("self.#{model_sym}")
|
113
115
|
|
114
116
|
unless model_defined
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Classy Inheritance</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/classyinherit"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/classyinherit" class="numbers">0.
|
36
|
+
<a href="http://rubyforge.org/projects/classyinherit" class="numbers">0.3.0</a>
|
37
37
|
</div>
|
38
38
|
<p><i>“You stay classy, inheritance” – Gibson</i></p>
|
39
39
|
|
@@ -104,24 +104,33 @@ require "classy-inheritance"
|
|
104
104
|
|
105
105
|
</pre>
|
106
106
|
|
107
|
-
<h2>
|
107
|
+
<h2>Github</h2>
|
108
108
|
|
109
109
|
|
110
110
|
<p>The Clone <span class="caps">URL</span>: git://github.com/stonean/classy-inheritance.git</p>
|
111
111
|
|
112
112
|
|
113
|
-
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a
|
113
|
+
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a>.</p>
|
114
114
|
|
115
115
|
|
116
116
|
<p>I’m new to git and this whole opensource project admin gig, so please be patient with my stumbling around.</p>
|
117
117
|
|
118
118
|
|
119
|
+
<h2>Contact</h2>
|
120
|
+
|
121
|
+
|
122
|
+
<p>Please use the <a href="http://stonean.com/projects/classy-inheritance/boards">forum</a> to ask questions and the <a href="http://stonean.com/projects/classy-inheritance/issues">issue tracker</a> to report problems or submit a pull request.</p>
|
123
|
+
|
124
|
+
|
119
125
|
<h2>License</h2>
|
120
126
|
|
121
127
|
|
122
128
|
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
|
129
|
+
|
130
|
+
|
131
|
+
<p>Copyright© 2008 Andrew Stone</p>
|
123
132
|
<p class="coda">
|
124
|
-
<a href="http://blog.stonean.com">Andrew Stone</a>,
|
133
|
+
<a href="http://blog.stonean.com">Andrew Stone</a>, 11th June 2008<br>
|
125
134
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
126
135
|
</p>
|
127
136
|
</div>
|
data/website/index.txt
CHANGED
@@ -58,14 +58,20 @@ require "classy-inheritance"
|
|
58
58
|
|
59
59
|
</pre>
|
60
60
|
|
61
|
-
h2.
|
61
|
+
h2. Github
|
62
62
|
|
63
63
|
The Clone URL: git://github.com/stonean/classy-inheritance.git
|
64
64
|
|
65
|
-
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code
|
65
|
+
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/.
|
66
66
|
|
67
67
|
I'm new to git and this whole opensource project admin gig, so please be patient with my stumbling around.
|
68
68
|
|
69
|
+
h2. Contact
|
70
|
+
|
71
|
+
Please use the "forum":http://stonean.com/projects/classy-inheritance/boards to ask questions and the "issue tracker":http://stonean.com/projects/classy-inheritance/issues to report problems or submit a pull request.
|
72
|
+
|
69
73
|
h2. License
|
70
74
|
|
71
75
|
This code is free to use under the terms of the MIT license.
|
76
|
+
|
77
|
+
Copyright (c) 2008 Andrew Stone
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classy-inheritance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-13 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|