couch_potato 1.1.0 → 1.1.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/CHANGES.md
CHANGED
|
@@ -21,6 +21,11 @@ module CouchPotato
|
|
|
21
21
|
@list << property
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
# XXX
|
|
25
|
+
def inspect
|
|
26
|
+
list.map(&:name).inspect
|
|
27
|
+
end
|
|
28
|
+
|
|
24
29
|
def inherited_properties
|
|
25
30
|
superclazz = @clazz.superclass
|
|
26
31
|
properties = []
|
|
@@ -38,6 +43,7 @@ module CouchPotato
|
|
|
38
43
|
def self.properties
|
|
39
44
|
@properties ||= {}
|
|
40
45
|
@properties[name] ||= PropertyList.new(self)
|
|
46
|
+
@properties[name]
|
|
41
47
|
end
|
|
42
48
|
end
|
|
43
49
|
end
|
|
@@ -43,11 +43,12 @@ module CouchPotato
|
|
|
43
43
|
private
|
|
44
44
|
|
|
45
45
|
def accessors_module_for(clazz)
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
module_name = "#{clazz.name.to_s.gsub('::', '__')}AccessorMethods"
|
|
47
|
+
unless clazz.const_defined?(module_name)
|
|
48
|
+
accessors_module = clazz.const_set(module_name, Module.new)
|
|
48
49
|
clazz.send(:include, accessors_module)
|
|
49
50
|
end
|
|
50
|
-
clazz.const_get(
|
|
51
|
+
clazz.const_get(module_name)
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def define_accessors(base, name, options)
|
data/lib/couch_potato/version.rb
CHANGED
data/spec/property_spec.rb
CHANGED
|
@@ -26,11 +26,27 @@ class CuckooClock < Watch
|
|
|
26
26
|
property :cuckoo
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
class SportsWatch < Watch
|
|
30
|
+
property :bpm
|
|
31
|
+
end
|
|
32
|
+
|
|
29
33
|
describe 'properties' do
|
|
30
34
|
before(:all) do
|
|
31
35
|
recreate_db
|
|
32
36
|
end
|
|
33
37
|
|
|
38
|
+
context 'inheritance' do
|
|
39
|
+
it 'has access to superclass properties' do
|
|
40
|
+
expect(CuckooClock.new.cuckoo).to be_nil
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "does not have access to properties of 'sibling classes'" do
|
|
44
|
+
expect {
|
|
45
|
+
CuckooClock.new.bpm
|
|
46
|
+
}.to raise_error(NoMethodError)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
34
50
|
it "should allow me to overwrite read accessor and call super" do
|
|
35
51
|
Watch.new(:overwritten_read => 1).overwritten_read.should == '1'
|
|
36
52
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: couch_potato
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-11-
|
|
12
|
+
date: 2013-11-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: json
|