lazyeval 0.0.2 → 0.0.3
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/CHANGELOG +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +21 -0
- data/{LICENSE → LICENSE.txt} +3 -1
- data/README.markdown +13 -10
- data/Rakefile +1 -26
- data/lazyeval.gemspec +22 -79
- data/lib/lazyeval/version.rb +3 -0
- data/lib/lazyeval.rb +3 -3
- data/test/test_lazyeval.rb +2 -2
- metadata +98 -60
- data/VERSION +0 -1
data/CHANGELOG
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lazyeval (0.0.3)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (10.0.4)
|
10
|
+
thoughtbot-shoulda (2.11.1)
|
11
|
+
yard (0.8.6.1)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
bundler (~> 1.3)
|
18
|
+
lazyeval!
|
19
|
+
rake
|
20
|
+
thoughtbot-shoulda
|
21
|
+
yard
|
data/{LICENSE → LICENSE.txt}
RENAMED
data/README.markdown
CHANGED
@@ -20,17 +20,20 @@ accessed.
|
|
20
20
|
user_name = User.lazy { |user| user.find(:first).user_name } # no db access
|
21
21
|
puts user_name # db will be accessed here
|
22
22
|
|
23
|
-
##
|
23
|
+
## Contributing
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Add tests for it. This is important so I don't break it in a future version
|
28
|
+
unintentionally.
|
29
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
6. Create new Pull Request
|
32
|
+
|
33
|
+
> NOTE: do not mess with rakefile, version, or history. (if you want to have
|
34
|
+
> your own version, that is fine but bump version in a commit by itself I can
|
35
|
+
> ignore when I pull)
|
33
36
|
|
34
37
|
## Copyright
|
35
38
|
|
36
|
-
Copyright (c)
|
39
|
+
Copyright (c) 2009-2013 Vitaly Kushner. See LICENSE.txt for details.
|
data/Rakefile
CHANGED
@@ -1,27 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "lazyeval"
|
8
|
-
gem.summary = %Q{This gem provides a very simple lazy evaluation for Ruby}
|
9
|
-
gem.description = %Q{This GEM allows to call methods lazily. The actual work will not be
|
10
|
-
performed until the result is used. There's no promise/force semantics, just a
|
11
|
-
single call (or block) is stored and executed the first time the (lazy) result
|
12
|
-
is accessed.
|
13
|
-
}
|
14
|
-
gem.email = "vitaly@astrails.com"
|
15
|
-
gem.homepage = "http://github.com/vitaly/lazyeval"
|
16
|
-
gem.authors = ["Vitaly Kushner"]
|
17
|
-
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
18
|
-
gem.add_development_dependency "yard", ">= 0"
|
19
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
-
end
|
21
|
-
Jeweler::GemcutterTasks.new
|
22
|
-
rescue LoadError
|
23
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
24
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
25
2
|
|
26
3
|
require 'rake/testtask'
|
27
4
|
Rake::TestTask.new(:test) do |test|
|
@@ -43,8 +20,6 @@ rescue LoadError
|
|
43
20
|
end
|
44
21
|
end
|
45
22
|
|
46
|
-
task :test => :check_dependencies
|
47
|
-
|
48
23
|
task :default => :test
|
49
24
|
|
50
25
|
begin
|
data/lazyeval.gemspec
CHANGED
@@ -1,85 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lazyeval/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
7
|
+
s.name = "lazyeval"
|
8
|
+
s.version = Lazy::VERSION
|
9
|
+
s.authors = ["Vitaly Kushner"]
|
10
|
+
s.email = ["vitaly@astrails.com"]
|
11
|
+
s.description = %q{This GEM allows to call methods lazily. The actual
|
12
|
+
work will not be performed until the result is used. There's no
|
13
|
+
promise/force semantics, just a single call (or block) is stored and
|
14
|
+
executed the first time the (lazy) result is accessed. }
|
15
|
+
s.summary = %q{This gem provides a very simple lazy evaluation for Ruby}
|
16
|
+
s.homepage = %q{http://github.com/vitaly/lazyeval}
|
17
|
+
s.license = "MIT"
|
9
18
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.description = %q{This GEM allows to call methods lazily. The actual work will not be
|
14
|
-
performed until the result is used. There's no promise/force semantics, just a
|
15
|
-
single call (or block) is stored and executed the first time the (lazy) result
|
16
|
-
is accessed.
|
17
|
-
}
|
18
|
-
s.email = %q{vitaly@astrails.com}
|
19
|
-
s.extra_rdoc_files = [
|
20
|
-
"LICENSE",
|
21
|
-
"README.markdown"
|
22
|
-
]
|
23
|
-
s.files = [
|
24
|
-
".document",
|
25
|
-
".gitignore",
|
26
|
-
".yardoc/checksums",
|
27
|
-
".yardoc/objects/Lazy.dat",
|
28
|
-
".yardoc/objects/Lazy/initialize_i.dat",
|
29
|
-
".yardoc/objects/Lazy/method_missing_i.dat",
|
30
|
-
".yardoc/objects/Object.dat",
|
31
|
-
".yardoc/objects/Object/lazy_i.dat",
|
32
|
-
".yardoc/objects/root.dat",
|
33
|
-
".yardoc/proxy_types",
|
34
|
-
"LICENSE",
|
35
|
-
"README.markdown",
|
36
|
-
"Rakefile",
|
37
|
-
"VERSION",
|
38
|
-
"doc/Lazy.html",
|
39
|
-
"doc/Object.html",
|
40
|
-
"doc/_index.html",
|
41
|
-
"doc/class_list.html",
|
42
|
-
"doc/css/common.css",
|
43
|
-
"doc/css/full_list.css",
|
44
|
-
"doc/css/style.css",
|
45
|
-
"doc/file.README.html",
|
46
|
-
"doc/file_list.html",
|
47
|
-
"doc/frames.html",
|
48
|
-
"doc/index.html",
|
49
|
-
"doc/js/app.js",
|
50
|
-
"doc/js/full_list.js",
|
51
|
-
"doc/js/jquery.js",
|
52
|
-
"doc/method_list.html",
|
53
|
-
"doc/top-level-namespace.html",
|
54
|
-
"lazyeval.gemspec",
|
55
|
-
"lib/lazyeval.rb",
|
56
|
-
"test/helper.rb",
|
57
|
-
"test/test_lazyeval.rb"
|
58
|
-
]
|
59
|
-
s.homepage = %q{http://github.com/vitaly/lazyeval}
|
60
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
19
|
+
s.files = `git ls-files`.split($/)
|
20
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
61
22
|
s.require_paths = ["lib"]
|
62
|
-
s.rubygems_version = %q{1.3.5}
|
63
|
-
s.summary = %q{This gem provides a very simple lazy evaluation for Ruby}
|
64
|
-
s.test_files = [
|
65
|
-
"test/helper.rb",
|
66
|
-
"test/test_lazyeval.rb"
|
67
|
-
]
|
68
23
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
74
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
75
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
76
|
-
else
|
77
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
78
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
79
|
-
end
|
80
|
-
else
|
81
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
82
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
83
|
-
end
|
24
|
+
s.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'thoughtbot-shoulda'
|
27
|
+
s.add_development_dependency 'yard'
|
84
28
|
end
|
85
|
-
|
data/lib/lazyeval.rb
CHANGED
@@ -4,8 +4,8 @@ class Object
|
|
4
4
|
end
|
5
5
|
end
|
6
6
|
|
7
|
-
class Lazy
|
8
|
-
undef_method(*(instance_methods - %w/__id__ __send__ respond_to? debugger/))
|
7
|
+
class Lazy < (::RUBY_VERSION < '1.9') ? Object : BasicObject
|
8
|
+
undef_method(*(instance_methods - %w/__id__ __send__ respond_to? debugger/)) if ::RUBY_VERSION < '1.9'
|
9
9
|
|
10
10
|
def initialize(obj, &block)
|
11
11
|
@obj, @block = obj, block
|
@@ -22,7 +22,7 @@ class Lazy
|
|
22
22
|
@res = @args ? @obj.send(*@args, &@block) : @block.call(@obj)
|
23
23
|
@done = true
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
@res.send(*args, &block)
|
27
27
|
end
|
28
28
|
end
|
data/test/test_lazyeval.rb
CHANGED
@@ -5,7 +5,7 @@ class TestLazyeval < Test::Unit::TestCase
|
|
5
5
|
src = [:a, :b]
|
6
6
|
x = src.lazy.shift
|
7
7
|
assert_equal [:a, :b], src
|
8
|
-
|
8
|
+
assert x === :a
|
9
9
|
assert_equal [:b], src
|
10
10
|
end
|
11
11
|
|
@@ -14,7 +14,7 @@ class TestLazyeval < Test::Unit::TestCase
|
|
14
14
|
x = src.lazy { |x| x.shift*3 }
|
15
15
|
|
16
16
|
assert_equal [1, 2], src
|
17
|
-
|
17
|
+
assert x === 3
|
18
18
|
assert_equal [2], src
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,52 +1,90 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazyeval
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.3
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Vitaly Kushner
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
date: 2013-06-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.3'
|
28
|
+
type: :development
|
29
|
+
prerelease: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
16
47
|
name: thoughtbot-shoulda
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
17
60
|
type: :development
|
18
|
-
|
19
|
-
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
61
|
+
prerelease: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
26
63
|
name: yard
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
27
76
|
type: :development
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
description: |
|
36
|
-
This GEM allows to call methods lazily. The actual work will not be
|
37
|
-
performed until the result is used. There's no promise/force semantics, just a
|
38
|
-
single call (or block) is stored and executed the first time the (lazy) result
|
39
|
-
is accessed.
|
40
|
-
|
41
|
-
email: vitaly@astrails.com
|
77
|
+
prerelease: false
|
78
|
+
description: ! "This GEM allows to call methods lazily. The actual\n work will not
|
79
|
+
be performed until the result is used. There's no\n promise/force semantics, just
|
80
|
+
a single call (or block) is stored and\n executed the first time the (lazy) result
|
81
|
+
is accessed. "
|
82
|
+
email:
|
83
|
+
- vitaly@astrails.com
|
42
84
|
executables: []
|
43
|
-
|
44
85
|
extensions: []
|
45
|
-
|
46
|
-
|
47
|
-
- LICENSE
|
48
|
-
- README.markdown
|
49
|
-
files:
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
50
88
|
- .document
|
51
89
|
- .gitignore
|
52
90
|
- .yardoc/checksums
|
@@ -57,10 +95,12 @@ files:
|
|
57
95
|
- .yardoc/objects/Object/lazy_i.dat
|
58
96
|
- .yardoc/objects/root.dat
|
59
97
|
- .yardoc/proxy_types
|
60
|
-
-
|
98
|
+
- CHANGELOG
|
99
|
+
- Gemfile
|
100
|
+
- Gemfile.lock
|
101
|
+
- LICENSE.txt
|
61
102
|
- README.markdown
|
62
103
|
- Rakefile
|
63
|
-
- VERSION
|
64
104
|
- doc/Lazy.html
|
65
105
|
- doc/Object.html
|
66
106
|
- doc/_index.html
|
@@ -79,36 +119,34 @@ files:
|
|
79
119
|
- doc/top-level-namespace.html
|
80
120
|
- lazyeval.gemspec
|
81
121
|
- lib/lazyeval.rb
|
122
|
+
- lib/lazyeval/version.rb
|
82
123
|
- test/helper.rb
|
83
124
|
- test/test_lazyeval.rb
|
84
|
-
has_rdoc: true
|
85
125
|
homepage: http://github.com/vitaly/lazyeval
|
86
|
-
licenses:
|
87
|
-
|
126
|
+
licenses:
|
127
|
+
- MIT
|
88
128
|
post_install_message:
|
89
|
-
rdoc_options:
|
90
|
-
|
91
|
-
require_paths:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
92
131
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
105
144
|
requirements: []
|
106
|
-
|
107
145
|
rubyforge_project:
|
108
|
-
rubygems_version: 1.
|
146
|
+
rubygems_version: 1.8.25
|
109
147
|
signing_key:
|
110
148
|
specification_version: 3
|
111
149
|
summary: This gem provides a very simple lazy evaluation for Ruby
|
112
|
-
test_files:
|
150
|
+
test_files:
|
113
151
|
- test/helper.rb
|
114
152
|
- test/test_lazyeval.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.2
|