lazy_methods 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,14 +6,13 @@ desc 'Default: run unit tests.'
6
6
  task :default => :test
7
7
 
8
8
  begin
9
- require 'spec/rake/spectask'
10
- desc 'Test the gem.'
11
- Spec::Rake::SpecTask.new(:test) do |t|
12
- t.spec_files = FileList.new('spec/**/*_spec.rb')
13
- end
9
+ require 'rspec'
10
+ require 'rspec/core/rake_task'
11
+ desc 'Run the unit tests'
12
+ RSpec::Core::RakeTask.new(:test)
14
13
  rescue LoadError
15
- tast :test do
16
- STDERR.puts "You must have rspec >= 1.3.0 to run the tests"
14
+ task :test do
15
+ STDERR.puts "You must have rspec 2.0 installed to run the tests"
17
16
  end
18
17
  end
19
18
 
@@ -32,11 +31,11 @@ begin
32
31
  gem.summary = %Q{Gem that adds lazy method wrapping to every object. Preceding any method with lazy_ will defer the invocation until the result is actually needed.}
33
32
  gem.description = %Q(Gem that adds lazy method wrapping to every object. Preceding any method with lazy_ will defer the invocation until the result is actually needed. This pattern is useful when used with caching systems.)
34
33
  gem.email = "brian@embellishedvisions.com"
35
- gem.homepage = "http://github.com/bdurand/acts_as_revisionable"
34
+ gem.homepage = "http://github.com/bdurand/lazy_methods"
36
35
  gem.authors = ["Brian Durand"]
37
36
  gem.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
38
37
 
39
- gem.add_development_dependency('rspec', '>= 1.3.0')
38
+ gem.add_development_dependency('rspec', '>= 2.0.0')
40
39
  gem.add_development_dependency('jeweler')
41
40
  end
42
41
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -1,57 +1,55 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{lazy_methods}
8
- s.version = "1.0.4"
8
+ s.version = "1.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Durand"]
12
- s.date = %q{2010-06-24}
12
+ s.date = %q{2011-01-19}
13
13
  s.description = %q{Gem that adds lazy method wrapping to every object. Preceding any method with lazy_ will defer the invocation until the result is actually needed. This pattern is useful when used with caching systems.}
14
14
  s.email = %q{brian@embellishedvisions.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- ".gitignore",
20
- "MIT-LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "lazy_methods.gemspec",
25
- "lib/lazy_methods.rb",
26
- "lib/lazy_methods/lazy_methods.rb",
27
- "spec/lazy_method_spec.rb",
28
- "spec/method_tester.rb",
29
- "spec/spec_helper.rb"
19
+ "MIT-LICENSE",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "lazy_methods.gemspec",
24
+ "lib/lazy_methods.rb",
25
+ "lib/lazy_methods/lazy_methods.rb",
26
+ "spec/lazy_method_spec.rb",
27
+ "spec/method_tester.rb",
28
+ "spec/spec_helper.rb"
30
29
  ]
31
- s.homepage = %q{http://github.com/bdurand/acts_as_revisionable}
30
+ s.homepage = %q{http://github.com/bdurand/lazy_methods}
32
31
  s.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
33
32
  s.require_paths = ["lib"]
34
- s.rubygems_version = %q{1.3.7}
33
+ s.rubygems_version = %q{1.4.1}
35
34
  s.summary = %q{Gem that adds lazy method wrapping to every object. Preceding any method with lazy_ will defer the invocation until the result is actually needed.}
36
35
  s.test_files = [
37
36
  "spec/lazy_method_spec.rb",
38
- "spec/method_tester.rb",
39
- "spec/spec_helper.rb"
37
+ "spec/method_tester.rb",
38
+ "spec/spec_helper.rb"
40
39
  ]
41
40
 
42
41
  if s.respond_to? :specification_version then
43
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
42
  s.specification_version = 3
45
43
 
46
44
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
- s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
45
+ s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
48
46
  s.add_development_dependency(%q<jeweler>, [">= 0"])
49
47
  else
50
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
48
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
51
49
  s.add_dependency(%q<jeweler>, [">= 0"])
52
50
  end
53
51
  else
54
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
52
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
55
53
  s.add_dependency(%q<jeweler>, [">= 0"])
56
54
  end
57
55
  end
@@ -2,52 +2,52 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'lazy_me
2
2
  Object.send(:include, LazyMethods::InstanceMethods) unless Object.include?(LazyMethods::InstanceMethods)
3
3
  require File.expand_path(File.dirname(__FILE__) + '/method_tester')
4
4
 
5
- context "LazyMethods InstanceMethods" do
5
+ describe LazyMethods::InstanceMethods do
6
6
 
7
7
  let(:object) { MethodTester.new }
8
8
 
9
- specify "should inject lazy method handling" do
9
+ it "should inject lazy method handling" do
10
10
  proxy = object.lazy_test("arg")
11
11
  proxy.to_s.should == "ARG"
12
12
  proxy.__proxy_loaded__.should == true
13
13
  end
14
14
 
15
- specify "should return a proxy object that has not been invoked yet" do
15
+ it "should return a proxy object that has not been invoked yet" do
16
16
  proxy = object.lazy_test("arg")
17
17
  proxy.__proxy_loaded__.should == false
18
18
  end
19
19
 
20
20
  end
21
21
 
22
- context "LazyMethods Proxy" do
22
+ describe LazyMethods::Proxy do
23
23
 
24
24
  let(:object) { MethodTester.new }
25
25
 
26
- specify "should be able to wrap a method without executing it" do
26
+ it "should be able to wrap a method without executing it" do
27
27
  proxy = object.lazy_test("arg")
28
28
  object.test_called.should == 0
29
29
  end
30
30
 
31
- specify "should execute the wrapped method when it needs to" do
31
+ it "should execute the wrapped method when it needs to" do
32
32
  proxy = object.lazy_test("arg")
33
33
  proxy.to_s
34
34
  object.test_called.should == 1
35
35
  end
36
36
 
37
- specify "should only execute the wrapped method once" do
37
+ it "should only execute the wrapped method once" do
38
38
  proxy = object.lazy_test("arg")
39
39
  proxy.to_s
40
40
  proxy.to_s
41
41
  object.test_called.should == 1
42
42
  end
43
43
 
44
- specify "should allow nil as a valid proxied value" do
44
+ it "should allow nil as a valid proxied value" do
45
45
  proxy = object.lazy_test(nil)
46
46
  proxy.should_not
47
47
  object.test_called.should == 1
48
48
  end
49
49
 
50
- specify "should allow blocks in the lazy method" do
50
+ it "should allow blocks in the lazy method" do
51
51
  n = 1
52
52
  proxy = object.lazy_test("arg") do
53
53
  n = 2
@@ -57,23 +57,23 @@ context "LazyMethods Proxy" do
57
57
  n.should == 2
58
58
  end
59
59
 
60
- specify "should be indistinguishable from the real object" do
60
+ it "should be indistinguishable from the real object" do
61
61
  proxy = object.lazy_test("arg")
62
62
  proxy.class.should == String
63
63
  proxy.kind_of?(String).should == true
64
64
  end
65
65
 
66
- specify "should proxy core methods on Object" do
66
+ it "should proxy core methods on Object" do
67
67
  proxy = "xxx".lazy_to_s
68
68
  proxy.should == "xxx"
69
69
  end
70
70
 
71
- specify "should proxy missing methods" do
71
+ it "should proxy missing methods" do
72
72
  proxy = object.lazy_find_test
73
73
  proxy.to_s.should == "FINDER"
74
74
  end
75
75
 
76
- specify "should allow blocks in the lazy missing methods" do
76
+ it "should allow blocks in the lazy missing methods" do
77
77
  n = 1
78
78
  proxy = object.lazy_find_test do
79
79
  n = 2
@@ -83,12 +83,12 @@ context "LazyMethods Proxy" do
83
83
  n.should == 2
84
84
  end
85
85
 
86
- specify "should not interfere with the proxied object's method_missing" do
86
+ it "should not interfere with the proxied object's method_missing" do
87
87
  real = object.find_test
88
88
  real.to_s.should == "FINDER"
89
89
  end
90
90
 
91
- specify "should not interfere with real methods that begin with lazy_" do
91
+ it "should not interfere with real methods that begin with lazy_" do
92
92
  object.lazy_real_method_called.should == false
93
93
  object.lazy_real_method
94
94
  object.lazy_real_method_called.should == true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy_methods
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 29
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Durand
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-24 00:00:00 -05:00
18
+ date: 2011-01-19 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 27
29
+ hash: 15
30
30
  segments:
31
- - 1
32
- - 3
31
+ - 2
32
+ - 0
33
33
  - 0
34
- version: 1.3.0
34
+ version: 2.0.0
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -57,7 +57,6 @@ extensions: []
57
57
  extra_rdoc_files:
58
58
  - README.rdoc
59
59
  files:
60
- - .gitignore
61
60
  - MIT-LICENSE
62
61
  - README.rdoc
63
62
  - Rakefile
@@ -69,7 +68,7 @@ files:
69
68
  - spec/method_tester.rb
70
69
  - spec/spec_helper.rb
71
70
  has_rdoc: true
72
- homepage: http://github.com/bdurand/acts_as_revisionable
71
+ homepage: http://github.com/bdurand/lazy_methods
73
72
  licenses: []
74
73
 
75
74
  post_install_message:
@@ -100,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
99
  requirements: []
101
100
 
102
101
  rubyforge_project:
103
- rubygems_version: 1.3.7
102
+ rubygems_version: 1.4.1
104
103
  signing_key:
105
104
  specification_version: 3
106
105
  summary: Gem that adds lazy method wrapping to every object. Preceding any method with lazy_ will defer the invocation until the result is actually needed.
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- pkg