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 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
@@ -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
- define_method attr do
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 "#{attr}=" do |val|
113
+ define_method "#{accessor_method_name}=" do |val|
112
114
  model_defined = eval("self.#{model_sym}")
113
115
 
114
116
  unless model_defined
@@ -1,8 +1,8 @@
1
1
  module ClassyInheritance #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 2
5
- TINY = 1
4
+ MINOR = 3
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.2.1</a>
36
+ <a href="http://rubyforge.org/projects/classyinherit" class="numbers">0.3.0</a>
37
37
  </div>
38
38
  <p><i>&#8220;You stay classy, inheritance&#8221; &#8211; Gibson</i></p>
39
39
 
@@ -104,24 +104,33 @@ require "classy-inheritance"
104
104
 
105
105
  </pre>
106
106
 
107
- <h2>How to submit patches</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&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
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&#8217;s code</a>.</p>
114
114
 
115
115
 
116
116
  <p>I&#8217;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&#169; 2008 Andrew Stone</p>
123
132
  <p class="coda">
124
- <a href="http://blog.stonean.com">Andrew Stone</a>, 2nd June 2008<br>
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. How to submit patches
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/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
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.2.1
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-09 00:00:00 -04:00
12
+ date: 2008-06-13 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15