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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 570e2a661194ac0301464cfe6fcdf0c23c99d344
|
4
|
+
data.tar.gz: 7df6c28fa47ca1bed47c159786dc3a3479a9b965
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
|
@@ -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.
|
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:
|
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.
|
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
|