doro 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/bin/doro +5 -4
- data/doc/Doro/Entries.html +201 -0
- data/doc/Gemfile.html +3 -4
- data/doc/Gemfile_lock.html +11 -13
- data/doc/ProgressBar.html +220 -0
- data/doc/README_md.html +167 -0
- data/doc/Rakefile.html +4 -2
- data/doc/created.rid +15 -12
- data/doc/doro_gemspec.html +12 -8
- data/doc/doro_rdoc.html +99 -6
- data/doc/features/doro_feature.html +16 -6
- data/doc/index.html +7 -1
- data/doc/js/search_index.js +1 -1
- data/doc/results_html.html +1677 -0
- data/doc/table_of_contents.html +54 -4
- data/doro.rdoc +66 -4
- data/lib/doro/entries.rb +14 -1
- data/lib/doro/progressbar.rb +17 -5
- data/lib/doro/version.rb +1 -1
- data/results.html +3 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67c69fad7536d5bf50dd14e11181ac3d8598eaa7
|
4
|
+
data.tar.gz: 179d5f6a03809dbd1a7a0e37e079ca6a29c81d18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab8bf1f0c9616aef470441d613c130d533e01956c462cba42f9d8d9679e9f48a305dc13682ac25c79df7bf1ccf95a3065edf5c964fdeefb40ea891fcbd75f25b
|
7
|
+
data.tar.gz: 6610bef49b0c32b5677959c440dac99b9334385722b4bfeb0fd353fd1ccf73d2207a42dbffdfa6cb957ef02c2b1f1828892c0e607052544d7dca1773d52c8d4a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/bin/doro
CHANGED
@@ -25,10 +25,9 @@ command :list do |c|
|
|
25
25
|
c.flag :n
|
26
26
|
|
27
27
|
c.action do |global_options,options,args|
|
28
|
-
|
29
|
-
Doro::Entries::display_entries(doro_file: doro_file, num_entries: options[:n])
|
30
|
-
|
28
|
+
Doro::Entries::display_entries(doro_file: doro_file, num_entries: options[:n].to_i)
|
31
29
|
end
|
30
|
+
|
32
31
|
end
|
33
32
|
|
34
33
|
desc 'Begins a pomodoro timer'
|
@@ -76,7 +75,9 @@ command :break do |c|
|
|
76
75
|
minutes = options[:t]
|
77
76
|
options[:long]? minutes = 15 : nil
|
78
77
|
|
79
|
-
ProgressBar.new('Break', minutes * 60).start
|
78
|
+
ProgressBar.new('Break', minutes * 60).start do
|
79
|
+
|
80
|
+
end
|
80
81
|
|
81
82
|
end
|
82
83
|
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Doro::Entries - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<script src="../js/jquery.js"></script>
|
14
|
+
<script src="../js/darkfish.js"></script>
|
15
|
+
|
16
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<body id="top" role="document" class="module">
|
22
|
+
<nav role="navigation">
|
23
|
+
<div id="project-navigation">
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
+
<h2>
|
26
|
+
<a href="../index.html" rel="home">Home</a>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<div id="table-of-contents-navigation">
|
30
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
31
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
32
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
38
|
+
<div id="search-field-wrapper">
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
46
|
+
aria-busy="false" aria-expanded="false"
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<div id="class-metadata">
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<!-- Method Quickref -->
|
61
|
+
<div id="method-list-section" class="nav-section">
|
62
|
+
<h3>Methods</h3>
|
63
|
+
|
64
|
+
<ul class="link-list" role="directory">
|
65
|
+
|
66
|
+
<li ><a href="#method-c-add_entry">::add_entry</a>
|
67
|
+
|
68
|
+
<li ><a href="#method-c-display_entries">::display_entries</a>
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
</div>
|
74
|
+
</nav>
|
75
|
+
|
76
|
+
<main role="main" aria-labelledby="module-Doro::Entries">
|
77
|
+
<h1 id="module-Doro::Entries" class="module">
|
78
|
+
module Doro::Entries
|
79
|
+
</h1>
|
80
|
+
|
81
|
+
<section class="description">
|
82
|
+
|
83
|
+
</section>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
99
|
+
<header>
|
100
|
+
<h3>Public Class Methods</h3>
|
101
|
+
</header>
|
102
|
+
|
103
|
+
|
104
|
+
<div id="method-c-add_entry" class="method-detail ">
|
105
|
+
|
106
|
+
<div class="method-heading">
|
107
|
+
<span class="method-name">add_entry</span><span
|
108
|
+
class="method-args">( doro_file: "</span>
|
109
|
+
|
110
|
+
<span class="method-click-advice">click to toggle source</span>
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
<div class="method-description">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<div class="method-source-code" id="add_entry-source">
|
123
|
+
<pre><span class="ruby-comment"># File lib/doro/entries.rb, line 23</span>
|
124
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">add_entry</span>(
|
125
|
+
<span class="ruby-identifier">doro_file</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{Dir.home}/.doro"</span>,
|
126
|
+
<span class="ruby-identifier">task_name</span><span class="ruby-operator">:</span> <span class="ruby-string">'none'</span>,
|
127
|
+
<span class="ruby-identifier">minutes</span><span class="ruby-operator">:</span> <span class="ruby-value">25</span>,
|
128
|
+
<span class="ruby-identifier">start_time</span>,,
|
129
|
+
<span class="ruby-identifier">tag</span><span class="ruby-operator">:</span> <span class="ruby-string">'untagged'</span>)
|
130
|
+
<span class="ruby-constant">CSV</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">doro_file</span>, <span class="ruby-string">"ab"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">csv</span><span class="ruby-operator">|</span>
|
131
|
+
<span class="ruby-identifier">csv</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">task_name</span>, <span class="ruby-identifier">minutes</span>, <span class="ruby-identifier">start_time</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">tag</span>]
|
132
|
+
<span class="ruby-keyword">end</span>
|
133
|
+
<span class="ruby-keyword">end</span></pre>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
<div id="method-c-display_entries" class="method-detail ">
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<span class="method-name">display_entries</span><span
|
148
|
+
class="method-args">(doro_file: "</span>
|
149
|
+
|
150
|
+
<span class="method-click-advice">click to toggle source</span>
|
151
|
+
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
<div class="method-description">
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<div class="method-source-code" id="display_entries-source">
|
163
|
+
<pre><span class="ruby-comment"># File lib/doro/entries.rb, line 6</span>
|
164
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">display_entries</span>(<span class="ruby-identifier">doro_file</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{Dir.home}/.doro"</span>, <span class="ruby-identifier">num_entries</span><span class="ruby-operator">:</span> <span class="ruby-value">10</span>)
|
165
|
+
<span class="ruby-identifier">rows</span> = []
|
166
|
+
<span class="ruby-identifier">start_index</span> = <span class="ruby-identifier">num_entries</span>
|
167
|
+
|
168
|
+
<span class="ruby-constant">CSV</span>.<span class="ruby-identifier">foreach</span> <span class="ruby-identifier">doro_file</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span>
|
169
|
+
<span class="ruby-identifier">rows</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">row</span>
|
170
|
+
<span class="ruby-keyword">end</span>
|
171
|
+
|
172
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">rows</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">num_entries</span>
|
173
|
+
<span class="ruby-identifier">start_index</span> = <span class="ruby-identifier">rows</span>.<span class="ruby-identifier">size</span>
|
174
|
+
<span class="ruby-keyword">end</span>
|
175
|
+
|
176
|
+
<span class="ruby-identifier">start_index</span> <span class="ruby-operator">*=</span> <span class="ruby-value">-1</span>
|
177
|
+
|
178
|
+
<span class="ruby-identifier">pp</span> <span class="ruby-identifier">rows</span>[<span class="ruby-identifier">start_index</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
179
|
+
<span class="ruby-keyword">end</span></pre>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
</section>
|
191
|
+
|
192
|
+
</section>
|
193
|
+
</main>
|
194
|
+
|
195
|
+
|
196
|
+
<footer id="validator-badges" role="contentinfo">
|
197
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
198
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
199
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
200
|
+
</footer>
|
201
|
+
|
data/doc/Gemfile.html
CHANGED
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
<li><a href="./Gemfile_lock.html">Gemfile.lock</a>
|
64
64
|
|
65
|
-
<li><a href="./
|
65
|
+
<li><a href="./README_md.html">README</a>
|
66
66
|
|
67
67
|
<li><a href="./Rakefile.html">Rakefile</a>
|
68
68
|
|
@@ -72,6 +72,8 @@
|
|
72
72
|
|
73
73
|
<li><a href="./features/doro_feature.html">doro.feature</a>
|
74
74
|
|
75
|
+
<li><a href="./results_html.html">results.html</a>
|
76
|
+
|
75
77
|
</ul>
|
76
78
|
</div>
|
77
79
|
|
@@ -81,9 +83,6 @@
|
|
81
83
|
<main role="main" aria-label="Page Gemfile">
|
82
84
|
|
83
85
|
<p>source '<a href="https://rubygems.org">rubygems.org</a>' gemspec</p>
|
84
|
-
|
85
|
-
<p>gem 'ruby-progressbar' gem 'gli' gem 'notifier' gem
|
86
|
-
'terminal-notifier'</p>
|
87
86
|
</main>
|
88
87
|
|
89
88
|
|
data/doc/Gemfile_lock.html
CHANGED
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
<li><a href="./Gemfile_lock.html">Gemfile.lock</a>
|
64
64
|
|
65
|
-
<li><a href="./
|
65
|
+
<li><a href="./README_md.html">README</a>
|
66
66
|
|
67
67
|
<li><a href="./Rakefile.html">Rakefile</a>
|
68
68
|
|
@@ -72,6 +72,8 @@
|
|
72
72
|
|
73
73
|
<li><a href="./features/doro_feature.html">doro.feature</a>
|
74
74
|
|
75
|
+
<li><a href="./results_html.html">results.html</a>
|
76
|
+
|
75
77
|
</ul>
|
76
78
|
</div>
|
77
79
|
|
@@ -84,8 +86,10 @@
|
|
84
86
|
|
85
87
|
<pre>remote: .
|
86
88
|
specs:
|
87
|
-
doro (0.
|
88
|
-
gli (= 2.13.4)
|
89
|
+
doro (0.2.3)
|
90
|
+
gli (= 2.13.4)
|
91
|
+
notifier (~> 0.5)
|
92
|
+
terminal-notifier (~> 1.6)</pre>
|
89
93
|
|
90
94
|
<p>GEM</p>
|
91
95
|
|
@@ -128,7 +132,6 @@ specs:
|
|
128
132
|
diff-lcs (>= 1.2.0, < 2.0)
|
129
133
|
rspec-support (~> 3.4.0)
|
130
134
|
rspec-support (3.4.1)
|
131
|
-
ruby-progressbar (1.7.5)
|
132
135
|
terminal-notifier (1.6.3)
|
133
136
|
thor (0.19.1)</pre>
|
134
137
|
|
@@ -139,15 +142,10 @@ specs:
|
|
139
142
|
|
140
143
|
<p>DEPENDENCIES</p>
|
141
144
|
|
142
|
-
<pre
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
<span class="ruby-identifier">rake</span>
|
147
|
-
<span class="ruby-identifier">rdoc</span>
|
148
|
-
<span class="ruby-identifier">ruby</span><span class="ruby-operator">-</span><span class="ruby-identifier">progressbar</span>
|
149
|
-
<span class="ruby-identifier">terminal</span><span class="ruby-operator">-</span><span class="ruby-identifier">notifier</span>
|
150
|
-
</pre>
|
145
|
+
<pre>aruba (~> 0.13)
|
146
|
+
doro!
|
147
|
+
rake (~> 10.5)
|
148
|
+
rdoc (~> 4.2)</pre>
|
151
149
|
|
152
150
|
<p>BUNDLED WITH</p>
|
153
151
|
|
@@ -0,0 +1,220 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class ProgressBar - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<script src="./js/jquery.js"></script>
|
14
|
+
<script src="./js/darkfish.js"></script>
|
15
|
+
|
16
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<body id="top" role="document" class="class">
|
22
|
+
<nav role="navigation">
|
23
|
+
<div id="project-navigation">
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
+
<h2>
|
26
|
+
<a href="./index.html" rel="home">Home</a>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<div id="table-of-contents-navigation">
|
30
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
31
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
32
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
38
|
+
<div id="search-field-wrapper">
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
46
|
+
aria-busy="false" aria-expanded="false"
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<div id="class-metadata">
|
56
|
+
|
57
|
+
<div id="parent-class-section" class="nav-section">
|
58
|
+
<h3>Parent</h3>
|
59
|
+
|
60
|
+
|
61
|
+
<p class="link"><a href="Object.html">Object</a>
|
62
|
+
|
63
|
+
</div>
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<div id="method-list-section" class="nav-section">
|
69
|
+
<h3>Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list" role="directory">
|
72
|
+
|
73
|
+
<li ><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li ><a href="#method-i-start">#start</a>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main" aria-labelledby="class-ProgressBar">
|
84
|
+
<h1 id="class-ProgressBar" class="class">
|
85
|
+
class ProgressBar
|
86
|
+
</h1>
|
87
|
+
|
88
|
+
<section class="description">
|
89
|
+
|
90
|
+
<p>This class handles the incrementing and display of the progress bar.</p>
|
91
|
+
|
92
|
+
</section>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
108
|
+
<header>
|
109
|
+
<h3>Public Class Methods</h3>
|
110
|
+
</header>
|
111
|
+
|
112
|
+
|
113
|
+
<div id="method-c-new" class="method-detail ">
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<span class="method-name">new</span><span
|
117
|
+
class="method-args">(title, max_progress)</span>
|
118
|
+
|
119
|
+
<span class="method-click-advice">click to toggle source</span>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<div class="method-description">
|
125
|
+
|
126
|
+
<p>Title can be any string, max_progress is in seconds.</p>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<div class="method-source-code" id="new-source">
|
132
|
+
<pre><span class="ruby-comment"># File lib/doro/progressbar.rb, line 13</span>
|
133
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">max_progress</span>)
|
134
|
+
<span class="ruby-ivar">@progress</span> = <span class="ruby-value">0</span>
|
135
|
+
<span class="ruby-ivar">@max_progress</span> = <span class="ruby-identifier">max_progress</span>
|
136
|
+
<span class="ruby-ivar">@title</span> = <span class="ruby-identifier">title</span>
|
137
|
+
<span class="ruby-ivar">@start_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
138
|
+
<span class="ruby-ivar">@interrupt</span> = <span class="ruby-keyword">false</span>
|
139
|
+
<span class="ruby-keyword">end</span></pre>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
</section>
|
151
|
+
|
152
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
153
|
+
<header>
|
154
|
+
<h3>Public Instance Methods</h3>
|
155
|
+
</header>
|
156
|
+
|
157
|
+
|
158
|
+
<div id="method-i-start" class="method-detail ">
|
159
|
+
|
160
|
+
<div class="method-heading">
|
161
|
+
<span class="method-name">start</span><span
|
162
|
+
class="method-args">() { || ... }</span>
|
163
|
+
|
164
|
+
<span class="method-click-advice">click to toggle source</span>
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
|
169
|
+
<div class="method-description">
|
170
|
+
|
171
|
+
<p>This starts the timer. It accepts a block which allows you plug in other
|
172
|
+
behaviors (such as incrementing another timer outside of the class).
|
173
|
+
You'd do something like:</p>
|
174
|
+
|
175
|
+
<pre class="ruby"><span class="ruby-constant">ProgressBar</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"Example"</span>, <span class="ruby-value">60</span>).<span class="ruby-identifier">start</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
176
|
+
<span class="ruby-identifier">p</span> <span class="ruby-string">'this fires every second'</span>
|
177
|
+
<span class="ruby-keyword">end</span>
|
178
|
+
</pre>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<div class="method-source-code" id="start-source">
|
184
|
+
<pre><span class="ruby-comment"># File lib/doro/progressbar.rb, line 29</span>
|
185
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>
|
186
|
+
<span class="ruby-constant">Signal</span>.<span class="ruby-identifier">trap</span>(<span class="ruby-string">"INT"</span>) { <span class="ruby-ivar">@interrupt</span> = <span class="ruby-keyword">true</span> }
|
187
|
+
|
188
|
+
<span class="ruby-keyword">while</span> (<span class="ruby-ivar">@progress</span> <span class="ruby-operator"><=</span> <span class="ruby-ivar">@max_progress</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@interrupt</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span> )
|
189
|
+
<span class="ruby-identifier">render_progress</span>
|
190
|
+
<span class="ruby-ivar">@progress</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
191
|
+
<span class="ruby-keyword">yield</span>
|
192
|
+
<span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span>
|
193
|
+
<span class="ruby-keyword">end</span>
|
194
|
+
|
195
|
+
<span class="ruby-identifier">print</span>(<span class="ruby-string">"\r"</span>)
|
196
|
+
|
197
|
+
<span class="ruby-identifier">display_notification</span>
|
198
|
+
<span class="ruby-keyword">end</span></pre>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</div>
|
207
|
+
|
208
|
+
|
209
|
+
</section>
|
210
|
+
|
211
|
+
</section>
|
212
|
+
</main>
|
213
|
+
|
214
|
+
|
215
|
+
<footer id="validator-badges" role="contentinfo">
|
216
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
217
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
218
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
219
|
+
</footer>
|
220
|
+
|