correlate 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ == 0.1.1 (2009-12-14)
2
+
3
+ * Fixed an issue where target classes are namespaced
4
+
5
+ == 0.1.0 (2009-12-13)
6
+
7
+ * Initial release
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{correlate}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kenneth Kalmer"]
12
- s.date = %q{2009-12-13}
12
+ s.date = %q{2009-12-14}
13
13
  s.email = %q{kenneth.kalmer@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.files = [
19
19
  ".document",
20
20
  ".gitignore",
21
+ "History.txt",
21
22
  "LICENSE",
22
23
  "README.rdoc",
23
24
  "Rakefile",
@@ -33,6 +34,7 @@ Gem::Specification.new do |s|
33
34
  "spec/active_record_spec.rb",
34
35
  "spec/activerecord_helper.rb",
35
36
  "spec/correlate_spec.rb",
37
+ "spec/correlation_spec.rb",
36
38
  "spec/fixtures/article.rb",
37
39
  "spec/fixtures/blank_doc.rb",
38
40
  "spec/fixtures/comment.rb",
@@ -59,6 +61,7 @@ Gem::Specification.new do |s|
59
61
  "spec/active_record_spec.rb",
60
62
  "spec/activerecord_helper.rb",
61
63
  "spec/correlate_spec.rb",
64
+ "spec/correlation_spec.rb",
62
65
  "spec/fixtures/article.rb",
63
66
  "spec/fixtures/blank_doc.rb",
64
67
  "spec/fixtures/comment.rb",
@@ -57,7 +57,7 @@
57
57
  # @see Correlate::Relationships::ActiveRecord
58
58
  module Correlate
59
59
 
60
- VERSION = '0.1.0'
60
+ VERSION = '0.1.1'
61
61
 
62
62
  autoload :Relationships, 'correlate/relationships'
63
63
  autoload :Links, 'correlate/links'
@@ -93,24 +93,25 @@ module Correlate
93
93
  { f => t }
94
94
  end
95
95
 
96
- private
97
-
98
- # The class method used to load instances of the documents.
99
- def load_via
100
- @load_via ||= (
101
- target_class.ancestors.include?( CouchRest::ExtendedDocument ) ? :get : :find
102
- )
103
- end
104
-
105
96
  def target_class
106
- raise "Class #{target} not found" if !Object.const_defined?( target.to_sym )
97
+ target.split('::').inject( Object ) do |parent, klass|
98
+ raise "Class #{klass} not found" if !parent.const_defined?( klass.to_sym )
107
99
 
108
- Object.const_get( target.to_sym )
100
+ parent.const_get( klass.to_sym )
101
+ end
109
102
  end
110
103
 
111
104
  def source_class
112
105
  source
113
106
  end
114
107
 
108
+ private
109
+
110
+ # The class method used to load instances of the documents.
111
+ def load_via
112
+ @load_via ||= (
113
+ target_class.ancestors.include?( CouchRest::ExtendedDocument ) ? :get : :find
114
+ )
115
+ end
115
116
  end
116
117
  end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ class Foo; end
4
+ module Bar
5
+ class Foo; end
6
+ end
7
+
8
+ describe Correlate::Correlation, "classify" do
9
+ before(:each) do
10
+ @correlation = Correlate::Correlation.new
11
+ end
12
+
13
+ it "should work on top level constants" do
14
+ @correlation.target = 'Foo'
15
+ @correlation.target_class.should == Foo
16
+ end
17
+
18
+ it "should work on nested classes" do
19
+ @correlation.target = 'Bar::Foo'
20
+ @correlation.target_class.should == Bar::Foo
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: correlate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Kalmer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-13 00:00:00 +02:00
12
+ date: 2009-12-14 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -64,6 +64,7 @@ extra_rdoc_files:
64
64
  files:
65
65
  - .document
66
66
  - .gitignore
67
+ - History.txt
67
68
  - LICENSE
68
69
  - README.rdoc
69
70
  - Rakefile
@@ -79,6 +80,7 @@ files:
79
80
  - spec/active_record_spec.rb
80
81
  - spec/activerecord_helper.rb
81
82
  - spec/correlate_spec.rb
83
+ - spec/correlation_spec.rb
82
84
  - spec/fixtures/article.rb
83
85
  - spec/fixtures/blank_doc.rb
84
86
  - spec/fixtures/comment.rb
@@ -127,6 +129,7 @@ test_files:
127
129
  - spec/active_record_spec.rb
128
130
  - spec/activerecord_helper.rb
129
131
  - spec/correlate_spec.rb
132
+ - spec/correlation_spec.rb
130
133
  - spec/fixtures/article.rb
131
134
  - spec/fixtures/blank_doc.rb
132
135
  - spec/fixtures/comment.rb