descendants_describable 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c650c74f19a68bd2dcce7e7275f89bd71c95b86
4
- data.tar.gz: c589dd0540996c8428088e099c42dc89166d137f
3
+ metadata.gz: 570e2a661194ac0301464cfe6fcdf0c23c99d344
4
+ data.tar.gz: 7df6c28fa47ca1bed47c159786dc3a3479a9b965
5
5
  SHA512:
6
- metadata.gz: fc3bf3c5b27f2e8f096427b1cde262adbe25f0590a632a50e80111ac9050b9ce0b9147928e14e9f6128bd9f30ef51959e8c93bf430950e5b24681c0307ede0af
7
- data.tar.gz: e218823dd0d83b50d3863505c77fe2d63d8129585726cb5a010d2a02018f03949a2b2bae95ae6197c43e921839c925fb07d1d3ed64253e8ae0aa671bfa88dfbb
6
+ metadata.gz: f670e49f3ff21073f732e4c53bdb8841c50082e7aba6915cabe1dcad5731d0bc345ba0d1c2dc702774845cea39a5cd16ed341caa8f6c85ff9d08c8095f7d1159
7
+ data.tar.gz: 5d49b9bfc1006b6c5fa8bf7f4cf14d7f20f4d7859f9b667f532203706bac2c7edaf92ddd7bfc53b4ba829a9a88daa6c86f1df21f12a88e9084a47f2e062542e6
@@ -25,13 +25,19 @@ module DescendantsDescribable
25
25
  end
26
26
 
27
27
  def type(name)
28
- self.new_class = Class.new(@parent)
28
+
29
+ self.new_class = begin
30
+ Object.const_get(name.to_s.camelize)
31
+ rescue NameError
32
+ new_class = Class.new(@parent)
33
+ Object.const_set(name.to_s.camelize, new_class)
34
+ new_class
35
+ end
29
36
 
30
37
  @common_modules.each { |m| self.new_class.send(:include, m) } if @common_modules.any?
31
38
 
32
39
  yield if block_given?
33
40
 
34
- Object.const_set(name.to_s.camelize, self.new_class)
35
41
  self.new_class = nil
36
42
  end
37
43
 
@@ -1,3 +1,3 @@
1
1
  module DescendantsDescribable
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -42,6 +42,7 @@ class Model < ActiveRecord::Base
42
42
  type :ladger do
43
43
  is_a_witch
44
44
  end
45
+ type :tadger
45
46
  end
46
47
  end
47
48
  end
@@ -71,6 +72,7 @@ describe DescendantsDescribable do
71
72
 
72
73
  expect(Tadger < Models::Descriptors::FloatsLikeADuck).to be_true
73
74
  expect(Tadger < Models::Descriptors::WalksLikeADuck).to be_true
75
+ expect(Tadger < Models::Descriptors::TalksLikeADuck).to be_true
74
76
 
75
77
  expect(Madger < Models::Descriptors::WalksLikeADuck).to be_true
76
78
  expect(Madger < Models::Descriptors::IsAWitch).to be_true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: descendants_describable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - winfred
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.0.0
151
+ rubygems_version: 2.0.14
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Turn a module of behavioral concerns into a DSL for describing a large set