hobix 0.4 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +18 -0
- data/README +18 -0
- data/Rakefile +96 -0
- data/bin/hobix +7 -3
- data/contrib/blosxom-to-hobix.rb +253 -0
- data/contrib/txp-to-hobix.rb +56 -0
- data/contrib/webrick-all-mine.rb +20 -0
- data/doc/CHANGELOG +285 -0
- data/doc/rdoc/classes/Hobix/API.html +382 -0
- data/doc/rdoc/classes/Hobix/Article.html +111 -0
- data/doc/rdoc/classes/Hobix/BaseContent.html +692 -0
- data/doc/rdoc/classes/Hobix/BaseEntry.html +218 -0
- data/doc/rdoc/classes/Hobix/BaseFacet.html +205 -0
- data/doc/rdoc/classes/Hobix/BaseOutput.html +122 -0
- data/doc/rdoc/classes/Hobix/BasePlugin.html +201 -0
- data/doc/rdoc/classes/Hobix/BaseProperties/ClassMethods.html +243 -0
- data/doc/rdoc/classes/Hobix/BaseProperties.html +218 -0
- data/doc/rdoc/classes/Hobix/BasePublish.html +157 -0
- data/doc/rdoc/classes/Hobix/BaseStorage.html +417 -0
- data/doc/rdoc/classes/Hobix/BixWik/Entry.html +196 -0
- data/doc/rdoc/classes/Hobix/BixWik/IndexEntry.html +170 -0
- data/doc/rdoc/classes/Hobix/BixWik/WikiRedCloth.html +111 -0
- data/doc/rdoc/classes/Hobix/BixWik.html +418 -0
- data/doc/rdoc/classes/Hobix/BixWikPlugin.html +158 -0
- data/doc/rdoc/classes/Hobix/CommandLine.html +1970 -0
- data/doc/rdoc/classes/Hobix/Comment.html +113 -0
- data/doc/rdoc/classes/Hobix/Config.html +212 -0
- data/doc/rdoc/classes/Hobix/DataMarsh.html +667 -0
- data/doc/rdoc/classes/Hobix/Entry.html +178 -0
- data/doc/rdoc/classes/Hobix/EntryEnum.html +162 -0
- data/doc/rdoc/classes/Hobix/Enumerable.html +170 -0
- data/doc/rdoc/classes/Hobix/Facets/WikiEdit.html +180 -0
- data/doc/rdoc/classes/Hobix/Facets.html +111 -0
- data/doc/rdoc/classes/Hobix/LinkList.html +182 -0
- data/doc/rdoc/classes/Hobix/Out/Quick.html +412 -0
- data/doc/rdoc/classes/Hobix/Out.html +119 -0
- data/doc/rdoc/classes/Hobix/Page.html +381 -0
- data/doc/rdoc/classes/Hobix/Trackback.html +113 -0
- data/doc/rdoc/classes/Hobix/UriStr.html +198 -0
- data/doc/rdoc/classes/Hobix/WebApp/QueryString.html +207 -0
- data/doc/rdoc/classes/Hobix/WebApp/QueryValidationFailure.html +111 -0
- data/doc/rdoc/classes/Hobix/WebApp.html +1383 -0
- data/doc/rdoc/classes/Hobix/Weblog/AuthorNotFound.html +111 -0
- data/doc/rdoc/classes/Hobix/Weblog.html +2082 -0
- data/doc/rdoc/classes/Hobix.html +399 -0
- data/doc/rdoc/classes/Kernel.html +139 -0
- data/doc/rdoc/classes/Regexp.html +154 -0
- data/doc/rdoc/classes/YAML/Omap.html +144 -0
- data/doc/rdoc/classes/YAML.html +111 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +129 -0
- data/doc/rdoc/files/README.html +131 -0
- data/doc/rdoc/files/doc/CHANGELOG.html +101 -0
- data/doc/rdoc/files/lib/hobix/api_rb.html +119 -0
- data/doc/rdoc/files/lib/hobix/article_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/base_rb.html +128 -0
- data/doc/rdoc/files/lib/hobix/bixwik_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/commandline_rb.html +140 -0
- data/doc/rdoc/files/lib/hobix/comments_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/config_rb.html +125 -0
- data/doc/rdoc/files/lib/hobix/datamarsh_rb.html +108 -0
- data/doc/rdoc/files/lib/hobix/entry_rb.html +118 -0
- data/doc/rdoc/files/lib/hobix/linklist_rb.html +127 -0
- data/doc/rdoc/files/lib/hobix/publisher_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/trackbacks_rb.html +128 -0
- data/doc/rdoc/files/lib/hobix/webapp_rb.html +127 -0
- data/doc/rdoc/files/lib/hobix/weblog_rb.html +135 -0
- data/doc/rdoc/files/lib/hobix_rb.html +127 -0
- data/doc/rdoc/fr_class_index.html +67 -0
- data/doc/rdoc/fr_file_index.html +44 -0
- data/doc/rdoc/fr_method_index.html +307 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/git_hobix_update.php +13 -0
- data/lib/hobix/base.rb +6 -3
- data/lib/hobix/bixwik.rb +12 -12
- data/lib/hobix/commandline.rb +18 -2
- data/lib/hobix/comments.rb +4 -5
- data/lib/hobix/entry.rb +2 -1
- data/lib/hobix/facets/comments.rb +31 -6
- data/lib/hobix/linklist.rb +6 -1
- data/lib/hobix/out/atom.rb +29 -20
- data/lib/hobix/out/quick.rb +8 -6
- data/lib/hobix/out/rss.rb +16 -3
- data/lib/hobix/plugin/akismet.rb +196 -0
- data/lib/hobix/plugin/calendar.rb +6 -14
- data/lib/hobix/plugin/recent_comments.rb +4 -2
- data/lib/hobix/plugin/tags.rb +1 -1
- data/lib/hobix/storage/filesys.rb +41 -31
- data/lib/hobix/trackbacks.rb +1 -2
- data/lib/hobix/weblog.rb +73 -40
- data/lib/hobix.rb +9 -2
- data/share/default-blog/hobix.yaml +16 -0
- data/share/default-blog/htdocs/site.css +174 -0
- data/share/default-blog/skel/entry.html.quick +0 -0
- data/share/default-blog/skel/index.atom.atom +0 -0
- data/share/default-blog/skel/index.html.quick-summary +0 -0
- data/share/default-blog/skel/index.xml.rss +0 -0
- data/share/default-blog/skel/index.yaml.okaynews +0 -0
- data/share/default-blog/skel/monthly.html.quick-archive +0 -0
- data/share/default-blog/skel/section.html.quick-archive +0 -0
- data/share/default-blog/skel/yearly.html.quick-archive +0 -0
- data/share/default-blog-modes.yaml +7 -0
- data/share/default-blog.apache-cgi.patch +8 -0
- data/share/default-blog.apache-ssi.patch +38 -0
- data/share/default-blog.apache2-ssi.patch +3 -0
- data/share/default-blog.cgi.patch +8 -0
- data/share/default-blog.comments.patch +5 -0
- data/share/default-blog.prototype.patch +766 -0
- data/share/default-blog.publisher.patch +5 -0
- data/share/default-blog.wiki.patch +29 -0
- data/share/publisher/css/control.css +90 -0
- data/share/publisher/css/form.css +238 -0
- data/share/publisher/css/form.import.css +72 -0
- data/share/publisher/css/main-menu.css +134 -0
- data/share/publisher/i/hobix-emblazen-1.png +0 -0
- data/share/publisher/i/hobix-emblazen-2.png +0 -0
- data/share/publisher/i/hobix-emblazen-3.png +0 -0
- data/share/publisher/i/hobix-emblazen-4.png +0 -0
- data/share/publisher/i/hobix-emblazen-5.png +0 -0
- data/share/publisher/i/hobix-emblazen-6.png +0 -0
- data/share/publisher/i/hobix-emblazen-7.png +0 -0
- data/share/publisher/index.erb +66 -0
- data/share/publisher/js/controls.js +261 -0
- data/share/publisher/js/dragdrop.js +476 -0
- data/share/publisher/js/effects.js +570 -0
- data/share/publisher/js/prototype.js +1011 -0
- metadata +196 -53
- checksums.yaml +0 -7
@@ -0,0 +1,178 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Hobix::Entry</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Hobix::Entry</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/hobix/entry_rb.html">
|
59
|
+
lib/hobix/entry.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="BaseEntry.html">
|
69
|
+
BaseEntry
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
The <a href="Entry.html">Entry</a> class stores complete data for an entry
|
86
|
+
on the site. All entry extensions should behave like this class as well.
|
87
|
+
</p>
|
88
|
+
<h2>Properties</h2>
|
89
|
+
<p>
|
90
|
+
At the very least, entry data should support the following accessors.
|
91
|
+
</p>
|
92
|
+
<table>
|
93
|
+
<tr><td valign="top">id:</td><td>The id (or shortName) for this entry. Includes the basic entry path.
|
94
|
+
|
95
|
+
</td></tr>
|
96
|
+
<tr><td valign="top">link:</td><td>The full URL to this entry from the weblog.
|
97
|
+
|
98
|
+
</td></tr>
|
99
|
+
<tr><td valign="top">title:</td><td>The heading for this entry.
|
100
|
+
|
101
|
+
</td></tr>
|
102
|
+
<tr><td valign="top">tagline:</td><td>The subheading for this entry.
|
103
|
+
|
104
|
+
</td></tr>
|
105
|
+
<tr><td valign="top">tags:</td><td>A list of free-tagged categories.
|
106
|
+
|
107
|
+
</td></tr>
|
108
|
+
<tr><td valign="top">author:</td><td>The author‘s username.
|
109
|
+
|
110
|
+
</td></tr>
|
111
|
+
<tr><td valign="top">contributors:</td><td>An Array of contributors’ usernames.
|
112
|
+
|
113
|
+
</td></tr>
|
114
|
+
<tr><td valign="top">created:</td><td>The time the <a href="Entry.html">Entry</a> was initially created.
|
115
|
+
|
116
|
+
</td></tr>
|
117
|
+
<tr><td valign="top">modified:</td><td>A modification time.
|
118
|
+
|
119
|
+
</td></tr>
|
120
|
+
<tr><td valign="top">updated:</td><td>Used internally to ensure an entry has been generated.
|
121
|
+
|
122
|
+
</td></tr>
|
123
|
+
<tr><td valign="top">summary:</td><td>A brief description of this entry. Can be used for an abbreviated text of a
|
124
|
+
long article.
|
125
|
+
|
126
|
+
</td></tr>
|
127
|
+
<tr><td valign="top">content:</td><td>The full text of the entry.
|
128
|
+
|
129
|
+
</td></tr>
|
130
|
+
</table>
|
131
|
+
<p>
|
132
|
+
The following read-only properties are also available:
|
133
|
+
</p>
|
134
|
+
<table>
|
135
|
+
<tr><td valign="top">day_id:</td><td>The day ID can act as a path where other entry, posted on the same day, are
|
136
|
+
stored.
|
137
|
+
|
138
|
+
</td></tr>
|
139
|
+
<tr><td valign="top">month_id:</td><td>A path for the month‘s entries.
|
140
|
+
|
141
|
+
</td></tr>
|
142
|
+
<tr><td valign="top">year_id:</td><td>A path for the year‘s entries.
|
143
|
+
|
144
|
+
</td></tr>
|
145
|
+
</table>
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
</div>
|
154
|
+
|
155
|
+
|
156
|
+
<!-- if includes -->
|
157
|
+
|
158
|
+
<div id="section">
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<!-- if method_list -->
|
168
|
+
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
<div id="validator-badges">
|
174
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
</body>
|
178
|
+
</html>
|
@@ -0,0 +1,162 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Hobix::EntryEnum</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Hobix::EntryEnum</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/hobix/entry_rb.html">
|
59
|
+
lib/hobix/entry.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
The <a href="EntryEnum.html">EntryEnum</a> class is mixed into an Array of
|
78
|
+
entries just before passing on to a template. This Enumerator-like module
|
79
|
+
provides some common iteration of entries.
|
80
|
+
</p>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="method-list">
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
89
|
+
|
90
|
+
<div class="name-list">
|
91
|
+
<a href="#M000006">each_day</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000006" class="method-detail">
|
114
|
+
<a name="M000006"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000006" class="method-signature">
|
118
|
+
<span class="method-name">each_day</span><span class="method-args">() {|day.first.created, day| ...}</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p>
|
124
|
+
Calls the block with two arguments: (1) a Time object with the earliest
|
125
|
+
date of an issued post for that day; (2) an Array of entries posted that
|
126
|
+
day, in chronological order.
|
127
|
+
</p>
|
128
|
+
<p><a class="source-toggle" href="#"
|
129
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
130
|
+
<div class="method-source-code" id="M000006-source">
|
131
|
+
<pre>
|
132
|
+
<span class="ruby-comment cmt"># File lib/hobix/entry.rb, line 71</span>
|
133
|
+
71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_day</span>
|
134
|
+
72: <span class="ruby-identifier">last_day</span>, <span class="ruby-identifier">day</span> = <span class="ruby-keyword kw">nil</span>, []
|
135
|
+
73: <span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
136
|
+
74: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last_day</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">last_day</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">day_id</span>
|
137
|
+
75: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">day</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">created</span>, <span class="ruby-identifier">day</span>
|
138
|
+
76: <span class="ruby-identifier">day</span> = []
|
139
|
+
77: <span class="ruby-keyword kw">end</span>
|
140
|
+
78: <span class="ruby-identifier">last_day</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">day_id</span>
|
141
|
+
79: <span class="ruby-identifier">day</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">e</span>
|
142
|
+
80: <span class="ruby-keyword kw">end</span>
|
143
|
+
81: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">day</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">created</span>, <span class="ruby-identifier">day</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last_day</span>
|
144
|
+
82: <span class="ruby-keyword kw">end</span>
|
145
|
+
</pre>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
</div>
|
155
|
+
|
156
|
+
|
157
|
+
<div id="validator-badges">
|
158
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
</body>
|
162
|
+
</html>
|
@@ -0,0 +1,170 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Hobix::Enumerable</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Hobix::Enumerable</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/hobix/base_rb.html">
|
59
|
+
lib/hobix/base.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
Enumerable::each_with_neighbors from Joel Vanderwerf‘s enum
|
78
|
+
extenstions.
|
79
|
+
</p>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div id="method-list">
|
87
|
+
<h3 class="section-bar">Methods</h3>
|
88
|
+
|
89
|
+
<div class="name-list">
|
90
|
+
<a href="#M000022">each_with_neighbors</a>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- if includes -->
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if method_list -->
|
109
|
+
<div id="methods">
|
110
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
111
|
+
|
112
|
+
<div id="method-M000022" class="method-detail">
|
113
|
+
<a name="M000022"></a>
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<a href="#M000022" class="method-signature">
|
117
|
+
<span class="method-name">each_with_neighbors</span><span class="method-args">(n = 1, empty = nil) {|nbrs| ...}</span>
|
118
|
+
</a>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="method-description">
|
122
|
+
<p><a class="source-toggle" href="#"
|
123
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
124
|
+
<div class="method-source-code" id="M000022-source">
|
125
|
+
<pre>
|
126
|
+
<span class="ruby-comment cmt"># File lib/hobix/base.rb, line 200</span>
|
127
|
+
200: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_with_neighbors</span> <span class="ruby-identifier">n</span> = <span class="ruby-value">1</span>, <span class="ruby-identifier">empty</span> = <span class="ruby-keyword kw">nil</span>
|
128
|
+
201: <span class="ruby-identifier">nbrs</span> = [<span class="ruby-identifier">empty</span>] <span class="ruby-operator">*</span> (<span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
|
129
|
+
202: <span class="ruby-identifier">offset</span> = <span class="ruby-identifier">n</span>
|
130
|
+
203:
|
131
|
+
204: <span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
132
|
+
205: <span class="ruby-identifier">nbrs</span>.<span class="ruby-identifier">shift</span>
|
133
|
+
206: <span class="ruby-identifier">nbrs</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">x</span>
|
134
|
+
207: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">offset</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-comment cmt"># offset is now the offset of the first element, x0,</span>
|
135
|
+
208: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">nbrs</span> <span class="ruby-comment cmt"># of the sequence from the center of nbrs, or 0,</span>
|
136
|
+
209: <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># if x0 has already passed the center.</span>
|
137
|
+
210: <span class="ruby-identifier">offset</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
|
138
|
+
211: <span class="ruby-keyword kw">end</span>
|
139
|
+
212: }
|
140
|
+
213:
|
141
|
+
214: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">times</span> {
|
142
|
+
215: <span class="ruby-identifier">nbrs</span>.<span class="ruby-identifier">shift</span>
|
143
|
+
216: <span class="ruby-identifier">nbrs</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">empty</span>
|
144
|
+
217: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">offset</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
145
|
+
218: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">nbrs</span>
|
146
|
+
219: <span class="ruby-keyword kw">else</span>
|
147
|
+
220: <span class="ruby-identifier">offset</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
|
148
|
+
221: <span class="ruby-keyword kw">end</span>
|
149
|
+
222: }
|
150
|
+
223:
|
151
|
+
224: <span class="ruby-keyword kw">self</span>
|
152
|
+
225: <span class="ruby-keyword kw">end</span>
|
153
|
+
</pre>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
<div id="validator-badges">
|
166
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
</body>
|
170
|
+
</html>
|