lazyeval 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/.yardoc/checksums +3 -0
  4. data/.yardoc/objects/Lazy.dat +0 -0
  5. data/.yardoc/objects/Lazy/initialize_i.dat +0 -0
  6. data/.yardoc/objects/Lazy/method_missing_i.dat +0 -0
  7. data/.yardoc/objects/Object.dat +0 -0
  8. data/.yardoc/objects/Object/lazy_i.dat +0 -0
  9. data/.yardoc/objects/root.dat +0 -0
  10. data/.yardoc/proxy_types +2 -0
  11. data/{License.txt → LICENSE} +1 -1
  12. data/README.markdown +36 -0
  13. data/Rakefile +57 -4
  14. data/VERSION +1 -0
  15. data/doc/Lazy.html +247 -0
  16. data/doc/Object.html +146 -0
  17. data/doc/_index.html +107 -0
  18. data/doc/class_list.html +36 -0
  19. data/doc/css/common.css +1 -0
  20. data/doc/css/full_list.css +50 -0
  21. data/doc/css/style.css +268 -0
  22. data/doc/file.README.html +92 -0
  23. data/doc/file_list.html +38 -0
  24. data/doc/frames.html +13 -0
  25. data/doc/index.html +92 -0
  26. data/doc/js/app.js +99 -0
  27. data/doc/js/full_list.js +106 -0
  28. data/doc/js/jquery.js +19 -0
  29. data/doc/method_list.html +59 -0
  30. data/doc/top-level-namespace.html +85 -0
  31. data/lazyeval.gemspec +85 -0
  32. data/test/helper.rb +10 -0
  33. data/test/test_lazyeval.rb +3 -7
  34. metadata +71 -39
  35. data/History.txt +0 -4
  36. data/Manifest.txt +0 -24
  37. data/README.txt +0 -22
  38. data/config/hoe.rb +0 -71
  39. data/config/requirements.rb +0 -17
  40. data/lib/lazyeval/version.rb +0 -9
  41. data/log/debug.log +0 -0
  42. data/script/destroy +0 -14
  43. data/script/generate +0 -14
  44. data/script/txt2html +0 -74
  45. data/setup.rb +0 -1585
  46. data/tasks/deployment.rake +0 -34
  47. data/tasks/environment.rake +0 -7
  48. data/tasks/website.rake +0 -17
  49. data/test/test_helper.rb +0 -2
  50. data/website/index.html +0 -105
  51. data/website/index.txt +0 -42
  52. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  53. data/website/stylesheets/screen.css +0 -138
  54. data/website/template.rhtml +0 -48
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.markdown
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/.yardoc/checksums ADDED
@@ -0,0 +1,3 @@
1
+ LICENSE eff2a4a19c0f9ea7d125f217c7fcb5cb333a552e
2
+ lib/lazyeval.rb d41987c6b935d583056129d92f27c1b96a0a6eb7
3
+ README.markdown 2da78fba2615696888d60fce25cbd84a64a55aa3
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,2 @@
1
+ {"BasicObject:
2
+ class
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008 Vitaly Kushner
1
+ Copyright (c) 2009 Vitaly Kushner
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown ADDED
@@ -0,0 +1,36 @@
1
+ # Lazyeval
2
+
3
+ Homepage: [http://github.com/vitaly/lazyeval/](http://github.com/vitaly/lazyeval/)
4
+
5
+ This GEM allows to call methods lazily. The actual work will not be performed
6
+ until the result is used. There's no promise/force semantics, just a single
7
+ call (or block) is stored and executed the first time the (lazy) result is
8
+ accessed.
9
+
10
+ ## USAGE
11
+
12
+ ### simple lazy call
13
+
14
+ user = User.lazy.find(:first) # will not access a db
15
+ puts user.name # this will actually perform the find and then get the name from
16
+ # the result
17
+
18
+ ### example for a lazy block
19
+
20
+ user_name = User.lazy { |user| user.find(:first).user_name } # no db access
21
+ puts user_name # db will be accessed here
22
+
23
+ ## Note on Patches/Pull Requests
24
+
25
+ * Fork the project.
26
+ * Make your feature addition or bug fix.
27
+ * Add tests for it. This is important so I don't break it in a future version
28
+ unintentionally.
29
+ * Commit, do not mess with rakefile, version, or history.
30
+ (if you want to have your own version, that is fine but bump version in a
31
+ commit by itself I can ignore when I pull)
32
+ * Send me a pull request. Bonus points for topic branches.
33
+
34
+ ## Copyright
35
+
36
+ Copyright (c) 2010 Vitaly Kushner. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,4 +1,57 @@
1
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
3
-
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
1
+ require 'rubygems'
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
25
+
26
+ require 'rake/testtask'
27
+ Rake::TestTask.new(:test) do |test|
28
+ test.libs << 'lib' << 'test'
29
+ test.pattern = 'test/**/test_*.rb'
30
+ test.verbose = true
31
+ end
32
+
33
+ begin
34
+ require 'rcov/rcovtask'
35
+ Rcov::RcovTask.new do |test|
36
+ test.libs << 'test'
37
+ test.pattern = 'test/**/test_*.rb'
38
+ test.verbose = true
39
+ end
40
+ rescue LoadError
41
+ task :rcov do
42
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
43
+ end
44
+ end
45
+
46
+ task :test => :check_dependencies
47
+
48
+ task :default => :test
49
+
50
+ begin
51
+ require 'yard'
52
+ YARD::Rake::YardocTask.new
53
+ rescue LoadError
54
+ task :yardoc do
55
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
56
+ end
57
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/doc/Lazy.html ADDED
@@ -0,0 +1,247 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: Lazy</title>
7
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="_index.html">Index (L)</a> &raquo;
27
+
28
+
29
+ <span class="title">Lazy</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: Lazy
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName"><a href="Object.html" title="Object (class)">Object</a></span>
56
+
57
+ <ul class="fullTree">
58
+ <li><a href="Object.html" title="Object (class)">Object</a></li>
59
+
60
+ <li class="next">Lazy</li>
61
+
62
+ </ul>
63
+ <a href="#" class="inheritanceTree">show all</a>
64
+
65
+ </dd>
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r2 last">Defined in:</dt>
75
+ <dd class="r2 last">lib/lazyeval.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+
81
+
82
+
83
+ <h2>Instance Method Summary</h2>
84
+
85
+ <ul class="summary">
86
+
87
+ <li class="public ">
88
+ <span class="summary_signature">
89
+
90
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Lazy) <strong>initialize</strong>(obj, &amp;block) </a>
91
+
92
+
93
+
94
+ </span>
95
+
96
+ <span class="note title constructor">constructor</span>
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <span class="summary_desc">
105
+ A new instance of Lazy.
106
+
107
+ </span>
108
+
109
+ </li>
110
+
111
+
112
+ <li class="public ">
113
+ <span class="summary_signature">
114
+
115
+ <a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(*args, &amp;block) </a>
116
+
117
+
118
+
119
+ </span>
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+ <span class="summary_desc"></span>
128
+
129
+ </li>
130
+
131
+
132
+ </ul>
133
+ <div id="constructor_details" class="method_details_list">
134
+ <h2>Constructor Details</h2>
135
+
136
+ <div class="method_details first">
137
+ <p class="signature first" id="initialize-instance_method">
138
+
139
+ - (<tt><a href="" title="Lazy (class)">Lazy</a></tt>) <strong>initialize</strong>(obj, &amp;block)
140
+
141
+
142
+
143
+ </p><div class="docstring">
144
+ <div class="discussion">
145
+ <p>
146
+ A new instance of Lazy
147
+ </p>
148
+
149
+
150
+ </div>
151
+ </div>
152
+ <div class="tags">
153
+
154
+ </div><table class="source_code">
155
+ <tr>
156
+ <td>
157
+ <pre class="lines">
158
+
159
+
160
+ 10
161
+ 11
162
+ 12
163
+ 13</pre>
164
+ </td>
165
+ <td>
166
+ <pre class="code"><span class="info file"># File 'lib/lazyeval.rb', line 10</span>
167
+
168
+ <span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='obj identifier id'>obj</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='block identifier id'>block</span><span class='rparen token'>)</span>
169
+ <span class='@obj ivar id'>@obj</span><span class='comma token'>,</span> <span class='@block ivar id'>@block</span> <span class='assign token'>=</span> <span class='obj identifier id'>obj</span><span class='comma token'>,</span> <span class='block identifier id'>block</span>
170
+ <span class='@args ivar id'>@args</span> <span class='assign token'>=</span> <span class='@done ivar id'>@done</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
171
+ <span class='end end kw'>end</span>
172
+ </pre>
173
+ </td>
174
+ </tr>
175
+ </table>
176
+ </div>
177
+
178
+ </div>
179
+ <div id="method_missing_details" class="method_details_list">
180
+ <h2>Dynamic Method Handling</h2>
181
+ <p class="notice this">
182
+ This class handles dynamic methods through the <tt>method_missing</tt> method
183
+
184
+ </p>
185
+
186
+ <div class="method_details first">
187
+ <p class="signature first" id="method_missing-instance_method">
188
+
189
+ - (<tt><a href="Object.html" title="Object (class)">Object</a></tt>) <strong>method_missing</strong>(*args, &amp;block)
190
+
191
+
192
+
193
+ </p><table class="source_code">
194
+ <tr>
195
+ <td>
196
+ <pre class="lines">
197
+
198
+
199
+ 15
200
+ 16
201
+ 17
202
+ 18
203
+ 19
204
+ 20
205
+ 21
206
+ 22
207
+ 23
208
+ 24
209
+ 25
210
+ 26
211
+ 27</pre>
212
+ </td>
213
+ <td>
214
+ <pre class="code"><span class="info file"># File 'lib/lazyeval.rb', line 15</span>
215
+
216
+ <span class='def def kw'>def</span> <span class='method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='block identifier id'>block</span><span class='rparen token'>)</span>
217
+ <span class='unless unless kw'>unless</span> <span class='@done ivar id'>@done</span>
218
+ <span class='if if kw'>if</span> <span class='notop op'>!</span><span class='@args ivar id'>@args</span> <span class='andop op'>&amp;&amp;</span> <span class='notop op'>!</span><span class='@block ivar id'>@block</span>
219
+ <span class='@args ivar id'>@args</span><span class='comma token'>,</span> <span class='@block ivar id'>@block</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='@block ivar id'>@block</span>
220
+ <span class='return return kw'>return</span> <span class='self self kw'>self</span>
221
+ <span class='end end kw'>end</span>
222
+
223
+ <span class='@res ivar id'>@res</span> <span class='assign token'>=</span> <span class='@args ivar id'>@args</span> <span class='question op'>?</span> <span class='@obj ivar id'>@obj</span><span class='dot token'>.</span><span class='send identifier id'>send</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='@args ivar id'>@args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='@block ivar id'>@block</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='@block ivar id'>@block</span><span class='dot token'>.</span><span class='call identifier id'>call</span><span class='lparen token'>(</span><span class='@obj ivar id'>@obj</span><span class='rparen token'>)</span>
224
+ <span class='@done ivar id'>@done</span> <span class='assign token'>=</span> <span class='true true kw'>true</span>
225
+ <span class='end end kw'>end</span>
226
+
227
+ <span class='@res ivar id'>@res</span><span class='dot token'>.</span><span class='send identifier id'>send</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='block identifier id'>block</span><span class='rparen token'>)</span>
228
+ <span class='end end kw'>end</span>
229
+ </pre>
230
+ </td>
231
+ </tr>
232
+ </table>
233
+ </div>
234
+
235
+ </div>
236
+
237
+
238
+ </div>
239
+
240
+ <div id="footer">
241
+ Generated on Tue May 11 16:34:44 2010 by
242
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
243
+ 0.5.3 (ruby-1.8.6).
244
+ </div>
245
+
246
+ </body>
247
+ </html>
data/doc/Object.html ADDED
@@ -0,0 +1,146 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: Object</title>
7
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="_index.html">Index (O)</a> &raquo;
27
+
28
+
29
+ <span class="title">Object</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: Object
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">BasicObject</span>
56
+
57
+ </dd>
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+ <dt class="r2 last">Defined in:</dt>
67
+ <dd class="r2 last">lib/lazyeval.rb</dd>
68
+
69
+ </dl>
70
+ <div class="clear"></div>
71
+
72
+
73
+
74
+
75
+ <h2>Instance Method Summary</h2>
76
+
77
+ <ul class="summary">
78
+
79
+ <li class="public ">
80
+ <span class="summary_signature">
81
+
82
+ <a href="#lazy-instance_method" title="#lazy (instance method)">- (Object) <strong>lazy</strong>(&amp;block) </a>
83
+
84
+
85
+
86
+ </span>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ <span class="summary_desc"></span>
95
+
96
+ </li>
97
+
98
+
99
+ </ul>
100
+
101
+
102
+ <div id="instance_method_details" class="method_details_list">
103
+ <h2>Instance Method Details</h2>
104
+
105
+
106
+ <div class="method_details first">
107
+ <p class="signature first" id="lazy-instance_method">
108
+
109
+ - (<tt><a href="" title="Object (class)">Object</a></tt>) <strong>lazy</strong>(&amp;block)
110
+
111
+
112
+
113
+ </p><table class="source_code">
114
+ <tr>
115
+ <td>
116
+ <pre class="lines">
117
+
118
+
119
+ 2
120
+ 3
121
+ 4</pre>
122
+ </td>
123
+ <td>
124
+ <pre class="code"><span class="info file"># File 'lib/lazyeval.rb', line 2</span>
125
+
126
+ <span class='def def kw'>def</span> <span class='lazy identifier id'>lazy</span><span class='lparen token'>(</span><span class='bitand op'>&amp;</span><span class='block identifier id'>block</span><span class='rparen token'>)</span>
127
+ <span class='Lazy constant id'>Lazy</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='block identifier id'>block</span><span class='rparen token'>)</span>
128
+ <span class='end end kw'>end</span>
129
+ </pre>
130
+ </td>
131
+ </tr>
132
+ </table>
133
+ </div>
134
+
135
+ </div>
136
+
137
+ </div>
138
+
139
+ <div id="footer">
140
+ Generated on Tue May 11 16:34:44 2010 by
141
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
142
+ 0.5.3 (ruby-1.8.6).
143
+ </div>
144
+
145
+ </body>
146
+ </html>