lazyeval 0.0.1 → 0.0.2

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.
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
@@ -0,0 +1,92 @@
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>Documentation by YARD 0.5.3</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" title="Index">Index</a> &raquo;
27
+ <span class="title">File: README</span>
28
+
29
+
30
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
31
+ </div>
32
+
33
+ <div id="search">
34
+ <a id="class_list_link" href="#">Class List</a>
35
+ <a id="method_list_link" href="#">Method List</a>
36
+ <a id ="file_list_link" href="#">File List</a>
37
+ </div>
38
+
39
+ <div class="clear"></div>
40
+ </div>
41
+
42
+ <iframe id="search_frame"></iframe>
43
+
44
+ <div id="content"><div id='filecontents'><h1>Lazyeval</h1>
45
+
46
+ <p>Homepage: <a href="http://github.com/vitaly/lazyeval/">http://github.com/vitaly/lazyeval/</a></p>
47
+
48
+ <p>This GEM allows to call methods lazily. The actual work will not be performed
49
+ until the result is used. There's no promise/force semantics, just a single
50
+ call (or block) is stored and executed the first time the (lazy) result is
51
+ accessed.</p>
52
+
53
+ <h2>USAGE</h2>
54
+
55
+ <h3>simple lazy call</h3>
56
+
57
+ <pre class="code"><span class='user identifier id'>user</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='lazy identifier id'>lazy</span><span class='dot token'>.</span><span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:first</span><span class='rparen token'>)</span> <span class='comment val'># will not access a db</span>
58
+ <span class='puts identifier id'>puts</span> <span class='user identifier id'>user</span><span class='dot token'>.</span><span class='name identifier id'>name</span> <span class='comment val'># this will actually perform the find and then get the name from</span>
59
+ <span class='comment val'># the result</span>
60
+ </pre>
61
+
62
+ <h3>example for a lazy block</h3>
63
+
64
+ <pre class="code"><span class='user_name identifier id'>user_name</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='lazy identifier id'>lazy</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='user identifier id'>user</span><span class='bitor op'>|</span> <span class='user identifier id'>user</span><span class='dot token'>.</span><span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:first</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='user_name identifier id'>user_name</span> <span class='rbrace token'>}</span> <span class='comment val'># no db access</span>
65
+ <span class='puts identifier id'>puts</span> <span class='user_name identifier id'>user_name</span> <span class='comment val'># db will be accessed here</span>
66
+ </pre>
67
+
68
+ <h2>Note on Patches/Pull Requests</h2>
69
+
70
+ <ul>
71
+ <li>Fork the project.</li>
72
+ <li>Make your feature addition or bug fix.</li>
73
+ <li>Add tests for it. This is important so I don't break it in a future version
74
+ unintentionally.</li>
75
+ <li>Commit, do not mess with rakefile, version, or history.
76
+ (if you want to have your own version, that is fine but bump version in a
77
+ commit by itself I can ignore when I pull)</li>
78
+ <li>Send me a pull request. Bonus points for topic branches.</li>
79
+ </ul>
80
+
81
+ <h2>Copyright</h2>
82
+
83
+ <p>Copyright (c) 2010 Vitaly Kushner. See LICENSE for details.</p></div></div>
84
+
85
+ <div id="footer">
86
+ Generated on Tue May 11 16:34:44 2010 by
87
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
88
+ 0.5.3 (ruby-1.8.6).
89
+ </div>
90
+
91
+ </body>
92
+ </html>
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
7
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
8
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
9
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
10
+ <base id="base_target" target="_parent" />
11
+ </head>
12
+ <body>
13
+ <script type="text/javascript" charset="utf-8">
14
+ if (window.top.frames.main) {
15
+ document.getElementById('base_target').target = 'main';
16
+ document.body.className = 'frames';
17
+ }
18
+ </script>
19
+ <div id="content">
20
+ <h1 id="full_list_header">File List</h1>
21
+ <div id="nav">
22
+ <a target="_self" href="class_list.html">Classes</a> |
23
+ <a target="_self" href="method_list.html">Methods</a> |
24
+ <a target="_self" href="file_list.html">Files</a>
25
+ </div>
26
+ <div id="search">Search: <input type="text" /></div>
27
+
28
+ <ul id="full_list" class="files">
29
+
30
+
31
+ <li class="r1"><a href="index.html" title="README">README</a></li>
32
+
33
+
34
+ </ul>
35
+ </div>
36
+ </body>
37
+ </html>
38
+
data/doc/frames.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Documentation by YARD 0.5.3</title>
8
+ </head>
9
+ <frameset cols="20%,*">
10
+ <frame name="list" src="class_list.html" />
11
+ <frame name="main" src="index.html" />
12
+ </frameset>
13
+ </html>
data/doc/index.html ADDED
@@ -0,0 +1,92 @@
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>Documentation by YARD 0.5.3</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" title="Index">Index</a> &raquo;
27
+ <span class="title">File: README</span>
28
+
29
+
30
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
31
+ </div>
32
+
33
+ <div id="search">
34
+ <a id="class_list_link" href="#">Class List</a>
35
+ <a id="method_list_link" href="#">Method List</a>
36
+ <a id ="file_list_link" href="#">File List</a>
37
+ </div>
38
+
39
+ <div class="clear"></div>
40
+ </div>
41
+
42
+ <iframe id="search_frame"></iframe>
43
+
44
+ <div id="content"><div id='filecontents'><h1>Lazyeval</h1>
45
+
46
+ <p>Homepage: <a href="http://github.com/vitaly/lazyeval/">http://github.com/vitaly/lazyeval/</a></p>
47
+
48
+ <p>This GEM allows to call methods lazily. The actual work will not be performed
49
+ until the result is used. There's no promise/force semantics, just a single
50
+ call (or block) is stored and executed the first time the (lazy) result is
51
+ accessed.</p>
52
+
53
+ <h2>USAGE</h2>
54
+
55
+ <h3>simple lazy call</h3>
56
+
57
+ <pre class="code"><span class='user identifier id'>user</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='lazy identifier id'>lazy</span><span class='dot token'>.</span><span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:first</span><span class='rparen token'>)</span> <span class='comment val'># will not access a db</span>
58
+ <span class='puts identifier id'>puts</span> <span class='user identifier id'>user</span><span class='dot token'>.</span><span class='name identifier id'>name</span> <span class='comment val'># this will actually perform the find and then get the name from</span>
59
+ <span class='comment val'># the result</span>
60
+ </pre>
61
+
62
+ <h3>example for a lazy block</h3>
63
+
64
+ <pre class="code"><span class='user_name identifier id'>user_name</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='lazy identifier id'>lazy</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='user identifier id'>user</span><span class='bitor op'>|</span> <span class='user identifier id'>user</span><span class='dot token'>.</span><span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:first</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='user_name identifier id'>user_name</span> <span class='rbrace token'>}</span> <span class='comment val'># no db access</span>
65
+ <span class='puts identifier id'>puts</span> <span class='user_name identifier id'>user_name</span> <span class='comment val'># db will be accessed here</span>
66
+ </pre>
67
+
68
+ <h2>Note on Patches/Pull Requests</h2>
69
+
70
+ <ul>
71
+ <li>Fork the project.</li>
72
+ <li>Make your feature addition or bug fix.</li>
73
+ <li>Add tests for it. This is important so I don't break it in a future version
74
+ unintentionally.</li>
75
+ <li>Commit, do not mess with rakefile, version, or history.
76
+ (if you want to have your own version, that is fine but bump version in a
77
+ commit by itself I can ignore when I pull)</li>
78
+ <li>Send me a pull request. Bonus points for topic branches.</li>
79
+ </ul>
80
+
81
+ <h2>Copyright</h2>
82
+
83
+ <p>Copyright (c) 2010 Vitaly Kushner. See LICENSE for details.</p></div></div>
84
+
85
+ <div id="footer">
86
+ Generated on Tue May 11 16:34:44 2010 by
87
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
88
+ 0.5.3 (ruby-1.8.6).
89
+ </div>
90
+
91
+ </body>
92
+ </html>
data/doc/js/app.js ADDED
@@ -0,0 +1,99 @@
1
+ function createSourceLinks() {
2
+ $('.method_details_list .source_code').
3
+ before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
4
+ $('.toggleSource').toggle(function() {
5
+ $(this).parent().next().slideDown(100);
6
+ $(this).text("Hide source");
7
+ },
8
+ function() {
9
+ $(this).parent().next().slideUp(100);
10
+ $(this).text("View source");
11
+ });
12
+ }
13
+
14
+ function createDefineLinks() {
15
+ var tHeight = 0;
16
+ $('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
17
+ $('.toggleDefines').toggle(function() {
18
+ tHeight = $(this).parent().prev().height();
19
+ $(this).prev().show();
20
+ $(this).parent().prev().height($(this).parent().height());
21
+ $(this).text("(less)");
22
+ },
23
+ function() {
24
+ $(this).prev().hide();
25
+ $(this).parent().prev().height(tHeight);
26
+ $(this).text("more...")
27
+ });
28
+ }
29
+
30
+ function createFullTreeLinks() {
31
+ var tHeight = 0;
32
+ $('.inheritanceTree').toggle(function() {
33
+ tHeight = $(this).parent().prev().height();
34
+ $(this).prev().prev().hide();
35
+ $(this).prev().show();
36
+ $(this).text("(hide)");
37
+ $(this).parent().prev().height($(this).parent().height());
38
+ },
39
+ function() {
40
+ $(this).prev().prev().show();
41
+ $(this).prev().hide();
42
+ $(this).parent().prev().height(tHeight);
43
+ $(this).text("show all")
44
+ });
45
+ }
46
+
47
+ function fixBoxInfoHeights() {
48
+ $('dl.box dd.r1, dl.box dd.r2').each(function() {
49
+ $(this).prev().height($(this).height());
50
+ });
51
+ }
52
+
53
+ function searchFrameLinks() {
54
+ $('#method_list_link').click(function() {
55
+ toggleSearchFrame(this, relpath + 'method_list.html');
56
+ });
57
+
58
+ $('#class_list_link').click(function() {
59
+ toggleSearchFrame(this, relpath + 'class_list.html');
60
+ });
61
+
62
+ $('#file_list_link').click(function() {
63
+ toggleSearchFrame(this, relpath + 'file_list.html');
64
+ });
65
+ }
66
+
67
+ function toggleSearchFrame(id, link) {
68
+ var frame = $('#search_frame');
69
+ $('#search a').removeClass('active').addClass('inactive');
70
+ if (frame.attr('src') == link && frame.css('display') != "none") {
71
+ frame.slideUp(100);
72
+ $('#search a').removeClass('active inactive');
73
+ }
74
+ else {
75
+ $(id).addClass('active').removeClass('inactive');
76
+ frame.attr('src', link).slideDown(100);
77
+ }
78
+ }
79
+
80
+ function linkSummaries() {
81
+ $('.summary_signature').click(function() {
82
+ document.location = $(this).find('a').attr('href');
83
+ });
84
+ }
85
+
86
+ function framesInit() {
87
+ if (window.top.frames.main) {
88
+ document.body.className = 'frames';
89
+ $('#menu .noframes a').attr('href', document.location);
90
+ }
91
+ }
92
+
93
+ $(framesInit);
94
+ $(createSourceLinks);
95
+ $(createDefineLinks);
96
+ $(createFullTreeLinks);
97
+ $(fixBoxInfoHeights);
98
+ $(searchFrameLinks);
99
+ $(linkSummaries);
@@ -0,0 +1,106 @@
1
+ function fullListSearch() {
2
+ $('#search input').keyup(function() {
3
+ var value = this.value.toLowerCase();
4
+ if (value == "") {
5
+ $('#full_list').removeClass('insearch');
6
+ $('#full_list li').each(function() {
7
+ var link = $(this).children('a:last');
8
+ link.text(link.text());
9
+ });
10
+ if (clicked) {
11
+ clicked.parents('ul').each(function() {
12
+ $(this).removeClass('collapsed').prev().removeClass('collapsed');
13
+ });
14
+ }
15
+ highlight();
16
+ }
17
+ else {
18
+ $('#full_list').addClass('insearch');
19
+ $('#full_list li').each(function() {
20
+ var link = $(this).children('a:last');
21
+ var text = link.text();
22
+ if (text.toLowerCase().indexOf(value) == -1) {
23
+ $(this).removeClass('found');
24
+ link.text(link.text());
25
+ }
26
+ else {
27
+ $(this).css('padding-left', '10px').addClass('found');
28
+ link.html(link.text().replace(new RegExp("(" +
29
+ value.replace(/([\/.*+?|()\[\]{}\\])/g, "\\$1") + ")", "ig"),
30
+ '<strong>$1</strong>'));
31
+ }
32
+ });
33
+ highlight(true);
34
+ }
35
+
36
+ if ($('#full_list li:visible').size() == 0) {
37
+ $('#noresults').fadeIn();
38
+ }
39
+ else {
40
+ $('#noresults').hide();
41
+ }
42
+ });
43
+
44
+ $('#search input').focus();
45
+ $('#full_list').after("<div id='noresults'>No results were found.</div>")
46
+ }
47
+
48
+ clicked = null;
49
+ function linkList() {
50
+ $('#full_list li, #full_list li a:last').click(function(evt) {
51
+ if ($(this).hasClass('toggle')) return true;
52
+ if (this.tagName.toLowerCase() == "li") {
53
+ var toggle = $(this).children('a.toggle');
54
+ if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
55
+ toggle.click();
56
+ return false;
57
+ }
58
+ }
59
+ if (clicked) clicked.removeClass('clicked');
60
+ var win = window.parent;
61
+ if (window.top.frames.main) {
62
+ win = window.top.frames.main;
63
+ var title = $('html head title', win.document).text();
64
+ $('html head title', window.parent.document).text(title);
65
+ }
66
+ if (this.tagName.toLowerCase() == "a") {
67
+ clicked = $(this).parent('li').addClass('clicked');
68
+ win.location = this.href;
69
+ }
70
+ else {
71
+ clicked = $(this).addClass('clicked');
72
+ win.location = $(this).find('a:last').attr('href');
73
+ }
74
+ return false;
75
+ });
76
+ }
77
+
78
+ function collapse() {
79
+ if (!$('#full_list').hasClass('class')) return;
80
+ $('#full_list.class a.toggle').click(function() {
81
+ $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed');
82
+ highlight();
83
+ return false;
84
+ });
85
+ $('#full_list.class ul').each(function() {
86
+ $(this).addClass('collapsed').prev().addClass('collapsed');
87
+ });
88
+ $('#full_list.class').children().removeClass('collapsed');
89
+ highlight();
90
+ }
91
+
92
+ function highlight(no_padding) {
93
+ var n = 1;
94
+ $('#full_list li:visible').each(function() {
95
+ var next = n == 1 ? 2 : 1;
96
+ $(this).removeClass("r" + next).addClass("r" + n);
97
+ if (!no_padding && $('#full_list').hasClass('class')) {
98
+ $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px');
99
+ }
100
+ n = next;
101
+ });
102
+ }
103
+
104
+ $(fullListSearch);
105
+ $(linkList);
106
+ $(collapse);