classy-inheritance 0.2.0 → 0.2.1

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/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.2.1 2008-06-09
2
+ * 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
+ * Add: respond_to? :can_be test before adding to requisite class
1
4
  == 0.2.0 2008-06-02
2
5
  * Add: When defining a depends_on that is polymorhic the requisite class has two methods added: "is_a_<model>?" and "as_a_<model>".
3
6
  == 0.1.1 2008-05-30
@@ -42,7 +42,6 @@ module Stonean
42
42
  options[:attrs].each{|attr| define_accessors(model_sym, attr)}
43
43
  end
44
44
 
45
- private
46
45
 
47
46
  def can_be(model_sym, options = {})
48
47
  unless options[:as]
@@ -62,6 +61,8 @@ module Stonean
62
61
  end
63
62
  end
64
63
 
64
+ private
65
+
65
66
  def define_relationship(model_sym, options)
66
67
  if options[:as]
67
68
  has_one model_sym, polymorphic_constraints(options[:as])
@@ -122,8 +123,10 @@ module Stonean
122
123
  def define_can_be_method_on_requisite_class(model_sym, polymorphic_name)
123
124
  klass = model_sym.to_s.classify
124
125
  requisite_klass = eval(klass)
125
- requisite_klass.send :can_be, self.name.underscore,
126
+ unless requisite_klass.respond_to?(self.name.underscore.to_sym)
127
+ requisite_klass.send :can_be, self.name.underscore,
126
128
  :as => polymorphic_name
129
+ end
127
130
  end
128
131
 
129
132
  def polymorphic_constraints(polymorphic_name)
@@ -2,7 +2,7 @@ module ClassyInheritance #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
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.0</a>
36
+ <a href="http://rubyforge.org/projects/classyinherit" class="numbers">0.2.1</a>
37
37
  </div>
38
38
  <p><i>&#8220;You stay classy, inheritance&#8221; &#8211; Gibson</i></p>
39
39
 
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.0
4
+ version: 0.2.1
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-03 00:00:00 -04:00
12
+ date: 2008-06-09 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15