shenanigans 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -3
- data/README.rdoc +1 -1
- data/doc/Array.html +423 -202
- data/doc/Fixnum.html +155 -140
- data/doc/Hash.html +305 -206
- data/doc/Kernel.html +360 -249
- data/doc/Module.html +181 -153
- data/doc/Object.html +210 -201
- data/doc/String.html +166 -139
- data/doc/_index.html +188 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +162 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +62 -80
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -18
- data/doc/method_list.html +149 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/shenanigans.rb +3 -1
- data/lib/shenanigans/array.rb +3 -3
- data/lib/shenanigans/array/reductions.rb +29 -0
- data/lib/shenanigans/kernel.rb +4 -4
- data/lib/shenanigans/module.rb +1 -1
- data/lib/shenanigans/object.rb +2 -2
- data/lib/shenanigans/string.rb +1 -1
- data/test/array/test_reductions.rb +27 -0
- metadata +16 -36
- data/doc/README_rdoc.html +0 -199
- data/doc/created.rid +0 -25
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/js/darkfish.js +0 -155
- data/doc/js/navigation.js +0 -142
- data/doc/js/search.js +0 -94
- data/doc/js/search_index.js +0 -1
- data/doc/js/searcher.js +0 -228
- data/doc/rdoc.css +0 -595
- data/doc/table_of_contents.html +0 -114
data/doc/created.rid
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Wed, 06 Nov 2013 11:32:26 +0630
|
2
|
-
README.rdoc Thu, 17 May 2012 16:15:08 +0630
|
3
|
-
lib/shenanigans.rb Sun, 15 Jul 2012 04:23:13 +0630
|
4
|
-
lib/shenanigans/array.rb Thu, 28 Jun 2012 13:30:29 +0630
|
5
|
-
lib/shenanigans/array/caret.rb Thu, 28 Jun 2012 13:45:50 +0630
|
6
|
-
lib/shenanigans/array/random_subarray.rb Thu, 17 May 2012 04:33:23 +0630
|
7
|
-
lib/shenanigans/array/zip_with.rb Wed, 20 Jun 2012 01:53:27 +0630
|
8
|
-
lib/shenanigans/fixnum.rb Sun, 15 Jul 2012 04:19:59 +0630
|
9
|
-
lib/shenanigans/fixnum/string_length.rb Sun, 15 Jul 2012 04:30:21 +0630
|
10
|
-
lib/shenanigans/hash.rb Thu, 09 Aug 2012 23:02:30 +0630
|
11
|
-
lib/shenanigans/hash/extract.rb Thu, 09 Aug 2012 23:17:48 +0630
|
12
|
-
lib/shenanigans/hash/has_shape_pred.rb Wed, 20 Jun 2012 01:55:03 +0630
|
13
|
-
lib/shenanigans/hash/to_ostruct.rb Thu, 10 Oct 2013 23:47:27 +0630
|
14
|
-
lib/shenanigans/kernel.rb Wed, 06 Nov 2013 10:47:33 +0630
|
15
|
-
lib/shenanigans/kernel/fn.rb Wed, 06 Nov 2013 10:54:54 +0630
|
16
|
-
lib/shenanigans/kernel/prompt.rb Wed, 06 Nov 2013 10:55:11 +0630
|
17
|
-
lib/shenanigans/kernel/require_optional.rb Wed, 06 Nov 2013 10:54:41 +0630
|
18
|
-
lib/shenanigans/kernel/with.rb Wed, 06 Nov 2013 10:56:14 +0630
|
19
|
-
lib/shenanigans/module.rb Thu, 10 Oct 2013 21:59:25 +0630
|
20
|
-
lib/shenanigans/module/private_accessor.rb Wed, 06 Nov 2013 11:23:15 +0630
|
21
|
-
lib/shenanigans/object.rb Thu, 28 Jun 2012 13:40:12 +0630
|
22
|
-
lib/shenanigans/object/display.rb Fri, 25 May 2012 21:59:45 +0630
|
23
|
-
lib/shenanigans/object/it.rb Thu, 28 Jun 2012 13:37:56 +0630
|
24
|
-
lib/shenanigans/string.rb Mon, 20 Aug 2012 22:59:46 +0630
|
25
|
-
lib/shenanigans/string/in_groups_of.rb Mon, 20 Aug 2012 23:23:19 +0630
|
data/doc/images/add.png
DELETED
Binary file
|
data/doc/images/arrow_up.png
DELETED
Binary file
|
data/doc/images/brick.png
DELETED
Binary file
|
data/doc/images/brick_link.png
DELETED
Binary file
|
data/doc/images/bug.png
DELETED
Binary file
|
data/doc/images/bullet_black.png
DELETED
Binary file
|
Binary file
|
Binary file
|
data/doc/images/date.png
DELETED
Binary file
|
data/doc/images/delete.png
DELETED
Binary file
|
data/doc/images/find.png
DELETED
Binary file
|
Binary file
|
data/doc/images/macFFBgHack.png
DELETED
Binary file
|
data/doc/images/package.png
DELETED
Binary file
|
data/doc/images/page_green.png
DELETED
Binary file
|
Binary file
|
Binary file
|
data/doc/images/plugin.png
DELETED
Binary file
|
data/doc/images/ruby.png
DELETED
Binary file
|
data/doc/images/tag_blue.png
DELETED
Binary file
|
data/doc/images/tag_green.png
DELETED
Binary file
|
data/doc/images/transparent.png
DELETED
Binary file
|
data/doc/images/wrench.png
DELETED
Binary file
|
Binary file
|
data/doc/images/zoom.png
DELETED
Binary file
|
data/doc/js/darkfish.js
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
*
|
3
|
-
* Darkfish Page Functions
|
4
|
-
* $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
|
5
|
-
*
|
6
|
-
* Author: Michael Granger <mgranger@laika.com>
|
7
|
-
*
|
8
|
-
*/
|
9
|
-
|
10
|
-
/* Provide console simulation for firebug-less environments */
|
11
|
-
if (!("console" in window) || !("firebug" in console)) {
|
12
|
-
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
13
|
-
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
14
|
-
|
15
|
-
window.console = {};
|
16
|
-
for (var i = 0; i < names.length; ++i)
|
17
|
-
window.console[names[i]] = function() {};
|
18
|
-
};
|
19
|
-
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Unwrap the first element that matches the given @expr@ from the targets and return them.
|
23
|
-
*/
|
24
|
-
$.fn.unwrap = function( expr ) {
|
25
|
-
return this.each( function() {
|
26
|
-
$(this).parents( expr ).eq( 0 ).after( this ).remove();
|
27
|
-
});
|
28
|
-
};
|
29
|
-
|
30
|
-
|
31
|
-
function showSource( e ) {
|
32
|
-
var target = e.target;
|
33
|
-
var codeSections = $(target).
|
34
|
-
parents('.method-detail').
|
35
|
-
find('.method-source-code');
|
36
|
-
|
37
|
-
$(target).
|
38
|
-
parents('.method-detail').
|
39
|
-
find('.method-source-code').
|
40
|
-
slideToggle();
|
41
|
-
};
|
42
|
-
|
43
|
-
function hookSourceViews() {
|
44
|
-
$('.method-heading').click( showSource );
|
45
|
-
};
|
46
|
-
|
47
|
-
function toggleDebuggingSection() {
|
48
|
-
$('.debugging-section').slideToggle();
|
49
|
-
};
|
50
|
-
|
51
|
-
function hookDebuggingToggle() {
|
52
|
-
$('#debugging-toggle img').click( toggleDebuggingSection );
|
53
|
-
};
|
54
|
-
|
55
|
-
function hookTableOfContentsToggle() {
|
56
|
-
$('.indexpage li .toc-toggle').each( function() {
|
57
|
-
$(this).click( function() {
|
58
|
-
$(this).toggleClass('open');
|
59
|
-
});
|
60
|
-
|
61
|
-
var section = $(this).next();
|
62
|
-
|
63
|
-
$(this).click( function() {
|
64
|
-
section.slideToggle();
|
65
|
-
});
|
66
|
-
});
|
67
|
-
}
|
68
|
-
|
69
|
-
function hookSearch() {
|
70
|
-
var input = $('#search-field').eq(0);
|
71
|
-
var result = $('#search-results').eq(0);
|
72
|
-
$(result).show();
|
73
|
-
|
74
|
-
var search_section = $('#search-section').get(0);
|
75
|
-
$(search_section).show();
|
76
|
-
|
77
|
-
var search = new Search(search_data, input, result);
|
78
|
-
|
79
|
-
search.renderItem = function(result) {
|
80
|
-
var li = document.createElement('li');
|
81
|
-
var html = '';
|
82
|
-
|
83
|
-
// TODO add relative path to <script> per-page
|
84
|
-
html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
|
85
|
-
if (result.params)
|
86
|
-
html += '<span class="params">' + result.params + '</span>';
|
87
|
-
html += '</a>';
|
88
|
-
|
89
|
-
|
90
|
-
if (result.namespace)
|
91
|
-
html += '<p class="search-namespace">' + this.hlt(result.namespace);
|
92
|
-
|
93
|
-
if (result.snippet)
|
94
|
-
html += '<div class="search-snippet">' + result.snippet + '</div>';
|
95
|
-
|
96
|
-
li.innerHTML = html;
|
97
|
-
|
98
|
-
return li;
|
99
|
-
}
|
100
|
-
|
101
|
-
search.select = function(result) {
|
102
|
-
var result_element = result.get(0);
|
103
|
-
window.location.href = result_element.firstChild.firstChild.href;
|
104
|
-
}
|
105
|
-
|
106
|
-
search.scrollIntoView = search.scrollInWindow;
|
107
|
-
};
|
108
|
-
|
109
|
-
function highlightTarget( anchor ) {
|
110
|
-
console.debug( "Highlighting target '%s'.", anchor );
|
111
|
-
|
112
|
-
$("a[name]").each( function() {
|
113
|
-
if ( $(this).attr("name") == anchor ) {
|
114
|
-
if ( !$(this).parent().parent().hasClass('target-section') ) {
|
115
|
-
console.debug( "Wrapping the target-section" );
|
116
|
-
$('div.method-detail').unwrap( 'div.target-section' );
|
117
|
-
$(this).parent().wrap( '<div class="target-section"></div>' );
|
118
|
-
} else {
|
119
|
-
console.debug( "Already wrapped." );
|
120
|
-
}
|
121
|
-
}
|
122
|
-
});
|
123
|
-
};
|
124
|
-
|
125
|
-
function highlightLocationTarget() {
|
126
|
-
console.debug( "Location hash: %s", window.location.hash );
|
127
|
-
if ( ! window.location.hash || window.location.hash.length == 0 ) return;
|
128
|
-
|
129
|
-
var anchor = window.location.hash.substring(1);
|
130
|
-
console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
|
131
|
-
|
132
|
-
highlightTarget( anchor );
|
133
|
-
};
|
134
|
-
|
135
|
-
function highlightClickTarget( event ) {
|
136
|
-
console.debug( "Highlighting click target for event %o", event.target );
|
137
|
-
try {
|
138
|
-
var anchor = $(event.target).attr( 'href' ).substring(1);
|
139
|
-
console.debug( "Found target anchor: %s", anchor );
|
140
|
-
highlightTarget( anchor );
|
141
|
-
} catch ( err ) {
|
142
|
-
console.error( "Exception while highlighting: %o", err );
|
143
|
-
};
|
144
|
-
};
|
145
|
-
|
146
|
-
|
147
|
-
$(document).ready( function() {
|
148
|
-
hookSourceViews();
|
149
|
-
hookDebuggingToggle();
|
150
|
-
hookSearch();
|
151
|
-
highlightLocationTarget();
|
152
|
-
hookTableOfContentsToggle();
|
153
|
-
|
154
|
-
$('ul.link-list a').bind( "click", highlightClickTarget );
|
155
|
-
});
|
data/doc/js/navigation.js
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Navigation allows movement using the arrow keys through the search results.
|
3
|
-
*
|
4
|
-
* When using this library you will need to set scrollIntoView to the
|
5
|
-
* appropriate function for your layout. Use scrollInWindow if the container
|
6
|
-
* is not scrollable and scrollInElement if the container is a separate
|
7
|
-
* scrolling region.
|
8
|
-
*/
|
9
|
-
Navigation = new function() {
|
10
|
-
this.initNavigation = function() {
|
11
|
-
var _this = this;
|
12
|
-
|
13
|
-
$(document).keydown(function(e) {
|
14
|
-
_this.onkeydown(e);
|
15
|
-
}).keyup(function(e) {
|
16
|
-
_this.onkeyup(e);
|
17
|
-
});
|
18
|
-
|
19
|
-
this.navigationActive = true;
|
20
|
-
}
|
21
|
-
|
22
|
-
this.setNavigationActive = function(state) {
|
23
|
-
this.navigationActive = state;
|
24
|
-
this.clearMoveTimeout();
|
25
|
-
}
|
26
|
-
|
27
|
-
this.onkeyup = function(e) {
|
28
|
-
if (!this.navigationActive) return;
|
29
|
-
|
30
|
-
switch(e.keyCode) {
|
31
|
-
case 37: //Event.KEY_LEFT:
|
32
|
-
case 38: //Event.KEY_UP:
|
33
|
-
case 39: //Event.KEY_RIGHT:
|
34
|
-
case 40: //Event.KEY_DOWN:
|
35
|
-
this.clearMoveTimeout();
|
36
|
-
break;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
this.onkeydown = function(e) {
|
41
|
-
if (!this.navigationActive) return;
|
42
|
-
switch(e.keyCode) {
|
43
|
-
case 37: //Event.KEY_LEFT:
|
44
|
-
if (this.moveLeft()) e.preventDefault();
|
45
|
-
break;
|
46
|
-
case 38: //Event.KEY_UP:
|
47
|
-
if (e.keyCode == 38 || e.ctrlKey) {
|
48
|
-
if (this.moveUp()) e.preventDefault();
|
49
|
-
this.startMoveTimeout(false);
|
50
|
-
}
|
51
|
-
break;
|
52
|
-
case 39: //Event.KEY_RIGHT:
|
53
|
-
if (this.moveRight()) e.preventDefault();
|
54
|
-
break;
|
55
|
-
case 40: //Event.KEY_DOWN:
|
56
|
-
if (e.keyCode == 40 || e.ctrlKey) {
|
57
|
-
if (this.moveDown()) e.preventDefault();
|
58
|
-
this.startMoveTimeout(true);
|
59
|
-
}
|
60
|
-
break;
|
61
|
-
case 13: //Event.KEY_RETURN:
|
62
|
-
if (this.$current)
|
63
|
-
e.preventDefault();
|
64
|
-
this.select(this.$current);
|
65
|
-
break;
|
66
|
-
}
|
67
|
-
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
|
68
|
-
}
|
69
|
-
|
70
|
-
this.clearMoveTimeout = function() {
|
71
|
-
clearTimeout(this.moveTimeout);
|
72
|
-
this.moveTimeout = null;
|
73
|
-
}
|
74
|
-
|
75
|
-
this.startMoveTimeout = function(isDown) {
|
76
|
-
if (!$.browser.mozilla && !$.browser.opera) return;
|
77
|
-
if (this.moveTimeout) this.clearMoveTimeout();
|
78
|
-
var _this = this;
|
79
|
-
|
80
|
-
var go = function() {
|
81
|
-
if (!_this.moveTimeout) return;
|
82
|
-
_this[isDown ? 'moveDown' : 'moveUp']();
|
83
|
-
_this.moveTimout = setTimeout(go, 100);
|
84
|
-
}
|
85
|
-
this.moveTimeout = setTimeout(go, 200);
|
86
|
-
}
|
87
|
-
|
88
|
-
this.moveRight = function() {
|
89
|
-
}
|
90
|
-
|
91
|
-
this.moveLeft = function() {
|
92
|
-
}
|
93
|
-
|
94
|
-
this.move = function(isDown) {
|
95
|
-
}
|
96
|
-
|
97
|
-
this.moveUp = function() {
|
98
|
-
return this.move(false);
|
99
|
-
}
|
100
|
-
|
101
|
-
this.moveDown = function() {
|
102
|
-
return this.move(true);
|
103
|
-
}
|
104
|
-
|
105
|
-
/*
|
106
|
-
* Scrolls to the given element in the scrollable element view.
|
107
|
-
*/
|
108
|
-
this.scrollInElement = function(element, view) {
|
109
|
-
var offset, viewHeight, viewScroll, height;
|
110
|
-
offset = element.offsetTop;
|
111
|
-
height = element.offsetHeight;
|
112
|
-
viewHeight = view.offsetHeight;
|
113
|
-
viewScroll = view.scrollTop;
|
114
|
-
|
115
|
-
if (offset - viewScroll + height > viewHeight) {
|
116
|
-
view.scrollTop = offset - viewHeight + height;
|
117
|
-
}
|
118
|
-
if (offset < viewScroll) {
|
119
|
-
view.scrollTop = offset;
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
/*
|
124
|
-
* Scrolls to the given element in the window. The second argument is
|
125
|
-
* ignored
|
126
|
-
*/
|
127
|
-
this.scrollInWindow = function(element, ignored) {
|
128
|
-
var offset, viewHeight, viewScroll, height;
|
129
|
-
offset = element.offsetTop;
|
130
|
-
height = element.offsetHeight;
|
131
|
-
viewHeight = window.innerHeight;
|
132
|
-
viewScroll = window.scrollY;
|
133
|
-
|
134
|
-
if (offset - viewScroll + height > viewHeight) {
|
135
|
-
window.scrollTo(window.scrollX, offset - viewHeight + height);
|
136
|
-
}
|
137
|
-
if (offset < viewScroll) {
|
138
|
-
window.scrollTo(window.scrollX, offset);
|
139
|
-
}
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
data/doc/js/search.js
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
Search = function(data, input, result) {
|
2
|
-
this.data = data;
|
3
|
-
this.$input = $(input);
|
4
|
-
this.$result = $(result);
|
5
|
-
|
6
|
-
this.$current = null;
|
7
|
-
this.$view = this.$result.parent();
|
8
|
-
this.searcher = new Searcher(data.index);
|
9
|
-
this.init();
|
10
|
-
}
|
11
|
-
|
12
|
-
Search.prototype = $.extend({}, Navigation, new function() {
|
13
|
-
var suid = 1;
|
14
|
-
|
15
|
-
this.init = function() {
|
16
|
-
var _this = this;
|
17
|
-
var observer = function() {
|
18
|
-
_this.search(_this.$input[0].value);
|
19
|
-
};
|
20
|
-
this.$input.keyup(observer);
|
21
|
-
this.$input.click(observer); // mac's clear field
|
22
|
-
|
23
|
-
this.searcher.ready(function(results, isLast) {
|
24
|
-
_this.addResults(results, isLast);
|
25
|
-
})
|
26
|
-
|
27
|
-
this.initNavigation();
|
28
|
-
this.setNavigationActive(false);
|
29
|
-
}
|
30
|
-
|
31
|
-
this.search = function(value, selectFirstMatch) {
|
32
|
-
value = jQuery.trim(value).toLowerCase();
|
33
|
-
if (value) {
|
34
|
-
this.setNavigationActive(true);
|
35
|
-
} else {
|
36
|
-
this.setNavigationActive(false);
|
37
|
-
}
|
38
|
-
|
39
|
-
if (value == '') {
|
40
|
-
this.lastQuery = value;
|
41
|
-
this.$result.empty();
|
42
|
-
this.setNavigationActive(false);
|
43
|
-
} else if (value != this.lastQuery) {
|
44
|
-
this.lastQuery = value;
|
45
|
-
this.firstRun = true;
|
46
|
-
this.searcher.find(value);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
this.addResults = function(results, isLast) {
|
51
|
-
var target = this.$result.get(0);
|
52
|
-
if (this.firstRun && (results.length > 0 || isLast)) {
|
53
|
-
this.$current = null;
|
54
|
-
this.$result.empty();
|
55
|
-
}
|
56
|
-
|
57
|
-
for (var i=0, l = results.length; i < l; i++) {
|
58
|
-
target.appendChild(this.renderItem.call(this, results[i]));
|
59
|
-
};
|
60
|
-
|
61
|
-
if (this.firstRun && results.length > 0) {
|
62
|
-
this.firstRun = false;
|
63
|
-
this.$current = $(target.firstChild);
|
64
|
-
this.$current.addClass('current');
|
65
|
-
}
|
66
|
-
if (jQuery.browser.msie) this.$element[0].className += '';
|
67
|
-
}
|
68
|
-
|
69
|
-
this.move = function(isDown) {
|
70
|
-
if (!this.$current) return;
|
71
|
-
var $next = this.$current[isDown ? 'next' : 'prev']();
|
72
|
-
if ($next.length) {
|
73
|
-
this.$current.removeClass('current');
|
74
|
-
$next.addClass('current');
|
75
|
-
this.scrollIntoView($next[0], this.$view[0]);
|
76
|
-
this.$current = $next;
|
77
|
-
}
|
78
|
-
return true;
|
79
|
-
}
|
80
|
-
|
81
|
-
this.hlt = function(html) {
|
82
|
-
return this.escapeHTML(html).
|
83
|
-
replace(/\u0001/g, '<em>').
|
84
|
-
replace(/\u0002/g, '</em>');
|
85
|
-
}
|
86
|
-
|
87
|
-
this.escapeHTML = function(html) {
|
88
|
-
return html.replace(/[&<>]/g, function(c) {
|
89
|
-
return '&#' + c.charCodeAt(0) + ';';
|
90
|
-
});
|
91
|
-
}
|
92
|
-
|
93
|
-
});
|
94
|
-
|