property 1.1.0 → 1.2.0
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/.gitignore +2 -1
- data/History.txt +5 -0
- data/lib/property/schema.rb +4 -2
- data/lib/property/version.rb +1 -1
- data/property.gemspec +2 -2
- data/test/unit/property/declaration_test.rb +20 -0
- metadata +3 -3
data/.gitignore
CHANGED
data/History.txt
CHANGED
data/lib/property/schema.rb
CHANGED
|
@@ -130,12 +130,14 @@ module Property
|
|
|
130
130
|
|
|
131
131
|
def check_duplicate_method_definitions(role, keys)
|
|
132
132
|
common_keys = []
|
|
133
|
+
# we are in an instance's metaclass, find the class
|
|
134
|
+
superclass = @binding.ancestors.detect {|a| a.kind_of?(Class)}
|
|
133
135
|
keys.each do |k|
|
|
134
|
-
common_keys << k if
|
|
136
|
+
common_keys << k if superclass.method_defined?(k)
|
|
135
137
|
end
|
|
136
138
|
|
|
137
139
|
if !common_keys.empty?
|
|
138
|
-
raise RedefinedMethodError.new("Cannot include role '#{role.name}' in '#{@binding}'. Would hide methods in superclass: #{common_keys.join(', ')}")
|
|
140
|
+
raise RedefinedMethodError.new("Cannot include role '#{role.name}' in '#{@binding}'. Would hide methods in superclass (#{superclass}): #{common_keys.join(', ')}")
|
|
139
141
|
end
|
|
140
142
|
end
|
|
141
143
|
|
data/lib/property/version.rb
CHANGED
data/property.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{property}
|
|
8
|
-
s.version = "1.
|
|
8
|
+
s.version = "1.2.0"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Renaud Kern", "Gaspard Bucher"]
|
|
12
|
-
s.date = %q{2010-
|
|
12
|
+
s.date = %q{2010-09-26}
|
|
13
13
|
s.description = %q{Wrap model properties into a single database column and declare properties from within the model.}
|
|
14
14
|
s.email = %q{gaspard@teti.ch}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -77,6 +77,26 @@ class DeclarationTest < Test::Unit::TestCase
|
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
|
+
|
|
81
|
+
context 'An instance' do
|
|
82
|
+
subject do
|
|
83
|
+
Class.new(ActiveRecord::Base) do
|
|
84
|
+
set_table_name :dummies
|
|
85
|
+
include Property
|
|
86
|
+
end.new
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
should 'be able to include a role with _name_ property' do
|
|
90
|
+
role_with_name = Property::Role.new('foo')
|
|
91
|
+
role_with_name.property do |p|
|
|
92
|
+
p.string :name
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
assert_nothing_raised do
|
|
96
|
+
subject.has_role role_with_name
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end # An instance
|
|
80
100
|
|
|
81
101
|
context 'Property declaration' do
|
|
82
102
|
Superhero = Class.new(ActiveRecord::Base) do
|
metadata
CHANGED
|
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
|
4
4
|
prerelease: false
|
|
5
5
|
segments:
|
|
6
6
|
- 1
|
|
7
|
-
-
|
|
7
|
+
- 2
|
|
8
8
|
- 0
|
|
9
|
-
version: 1.
|
|
9
|
+
version: 1.2.0
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Renaud Kern
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-
|
|
18
|
+
date: 2010-09-26 00:00:00 +02:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|