time-lord 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.2-p180@time-lord"
8
+
9
+ #
10
+ # First we attempt to load the desired environment directly from the environment
11
+ # file. This is very fast and efficicent compared to running through the entire
12
+ # CLI and selector. If you want feedback on which environment was used then
13
+ # insert the word 'use' after --create as this triggers verbose mode.
14
+ #
15
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
16
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
17
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
18
+
19
+ [[ -s ".rvm/hooks/after_use" ]] && . ".rvm/hooks/after_use"
20
+ else
21
+ # If the environment file has not yet been created, use the RVM CLI to select.
22
+ rvm --create "$environment_id"
23
+ fi
24
+
25
+ #
26
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
27
+ # it be automatically loaded. Uncomment the following and adjust the filename if
28
+ # necessary.
29
+ #
30
+ # filename=".gems"
31
+ # if [[ -s "$filename" ]] ; then
32
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
33
+ # fi
34
+
35
+ #
36
+ # If you use bundler and would like to run bundle each time you enter the
37
+ # directory, you can uncomment the following code.
38
+ #
39
+ # # Ensure that Bundler is installed. Install it if it is not.
40
+ # if ! command -v bundle >/dev/null; then
41
+ # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
42
+ # gem install bundler
43
+ # fi
44
+ #
45
+ # # Bundle while reducing excess noise.
46
+ # printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
47
+ # bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
48
+ #
49
+
@@ -0,0 +1,2 @@
1
+ lib/time-lord.rb 93a21229aaa27912f8fbaf8113232f9299a94c04
2
+ lib/time-lord/version.rb 1d4a7d9f645c106306ef4700a69712b6ede43db0
Binary file
@@ -0,0 +1,2 @@
1
+ {I" Object:EF:
2
+ class
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Kurtis Rainbolt-Greene:
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in timelord.gemspec
4
+ gemspec
@@ -0,0 +1,53 @@
1
+ time-lord
2
+ ---------
3
+ The ruby gem `time-lord` gives extra (needed) methods to the ruby `time` class.
4
+ Originally started as gem that gave dwevelopers the `time-ago-in-words` method for the `time` class.
5
+ It evolved into a multi-part boost to the `Time` class.
6
+
7
+
8
+ *postscript* This gem was previously called "time-ago-in-words".
9
+ I changed this, obviously.
10
+
11
+
12
+ examples
13
+ ========
14
+ Examples:
15
+ >> Time.now.ago_in_words # => "just now"
16
+ >> Time.parse("1942-04-01").ago_in_words # => "7 decades ago"
17
+
18
+
19
+ future
20
+ ======
21
+ >> Time.yesterday
22
+ >> Time.last_month
23
+ >> Time.last_year
24
+ >> Time.now - 1.year
25
+ >> Time.now + 15.days
26
+ >> Time.last_month.last_day_of_the_month
27
+ >> Time.last_day_of_year
28
+
29
+ install
30
+ =======
31
+ `gem install time-lord`
32
+
33
+
34
+ contribute
35
+ ==========
36
+ Whatever you're cool with, really.
37
+
38
+
39
+ authors
40
+ =======
41
+ * https://github.com/krainboltgreene
42
+ * https://github.com/sirupsen
43
+
44
+
45
+ helpers
46
+ =======
47
+ * https://github.com/wolfwood
48
+ * https://github.com/henrikh
49
+
50
+
51
+ credits
52
+ =======
53
+ * The guy who did the Rails version. I'll find out sometime.
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,290 @@
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Class: Time</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 (T)</a> &raquo;
27
+
28
+
29
+ <span class="title">Time</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: Time
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+ <dt class="r1">Inherits:</dt>
55
+ <dd class="r1">
56
+ <span class="inheritName">Object</span>
57
+
58
+ <ul class="fullTree">
59
+ <li>Object</li>
60
+
61
+ <li class="next">Time</li>
62
+
63
+ </ul>
64
+ <a href="#" class="inheritanceTree">show all</a>
65
+
66
+ </dd>
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/time-lord.rb</dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+
83
+ <h2>Constant Summary</h2>
84
+
85
+ <dl class="constants">
86
+
87
+ <dt id="Second-constant" class="">Second =
88
+
89
+ </dt>
90
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
91
+
92
+ <dt id="Minute-constant" class="">Minute =
93
+
94
+ </dt>
95
+ <dd><pre class="code"><span class='const'>Second</span> <span class='op'>*</span> <span class='int'>60</span></pre></dd>
96
+
97
+ <dt id="Hour-constant" class="">Hour =
98
+
99
+ </dt>
100
+ <dd><pre class="code"><span class='const'>Minute</span> <span class='op'>*</span> <span class='int'>60</span></pre></dd>
101
+
102
+ <dt id="Day-constant" class="">Day =
103
+
104
+ </dt>
105
+ <dd><pre class="code"><span class='const'>Hour</span> <span class='op'>*</span> <span class='int'>24</span></pre></dd>
106
+
107
+ <dt id="Week-constant" class="">Week =
108
+
109
+ </dt>
110
+ <dd><pre class="code"><span class='const'>Day</span> <span class='op'>*</span> <span class='int'>7</span></pre></dd>
111
+
112
+ <dt id="Fortnight-constant" class="">Fortnight =
113
+
114
+ </dt>
115
+ <dd><pre class="code"><span class='const'>Week</span> <span class='op'>*</span> <span class='int'>2</span></pre></dd>
116
+
117
+ <dt id="Month-constant" class="">Month =
118
+
119
+ </dt>
120
+ <dd><pre class="code"><span class='const'>Week</span> <span class='op'>*</span> <span class='int'>4</span></pre></dd>
121
+
122
+ <dt id="Quarter-constant" class="">Quarter =
123
+
124
+ </dt>
125
+ <dd><pre class="code"><span class='const'>Month</span> <span class='op'>*</span> <span class='int'>3</span></pre></dd>
126
+
127
+ <dt id="Year-constant" class="">Year =
128
+
129
+ </dt>
130
+ <dd><pre class="code"><span class='const'>Month</span> <span class='op'>*</span> <span class='int'>12</span></pre></dd>
131
+
132
+ <dt id="Olympiad-constant" class="">Olympiad =
133
+
134
+ </dt>
135
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>4</span></pre></dd>
136
+
137
+ <dt id="Lustrum-constant" class="">Lustrum =
138
+
139
+ </dt>
140
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>5</span></pre></dd>
141
+
142
+ <dt id="Decade-constant" class="">Decade =
143
+
144
+ </dt>
145
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>10</span></pre></dd>
146
+
147
+ <dt id="Indiction-constant" class="">Indiction =
148
+
149
+ </dt>
150
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>15</span></pre></dd>
151
+
152
+ <dt id="Jubilee-constant" class="">Jubilee =
153
+
154
+ </dt>
155
+ <dd><pre class="code"><span class='const'>Decade</span> <span class='op'>*</span> <span class='int'>5</span></pre></dd>
156
+
157
+ <dt id="Century-constant" class="">Century =
158
+
159
+ </dt>
160
+ <dd><pre class="code"><span class='const'>Decade</span> <span class='op'>*</span> <span class='int'>10</span></pre></dd>
161
+
162
+ <dt id="Millennium-constant" class="">Millennium =
163
+
164
+ </dt>
165
+ <dd><pre class="code"><span class='const'>Century</span> <span class='op'>*</span> <span class='int'>10</span></pre></dd>
166
+
167
+ <dt id="Eon-constant" class="">Eon =
168
+
169
+ </dt>
170
+ <dd><pre class="code"><span class='float'>1.0</span><span class='op'>/</span><span class='int'>0</span></pre></dd>
171
+
172
+ </dl>
173
+
174
+
175
+
176
+
177
+
178
+ <h2>
179
+ Instance Method Summary
180
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
181
+ </h2>
182
+
183
+ <ul class="summary">
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
188
+ <a href="#ago_in_words-instance_method" title="#ago_in_words (instance method)">- (Object) <strong>ago_in_words</strong> </a>
189
+
190
+
191
+
192
+ (also: #time_ago_in_words)
193
+
194
+ </span>
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+ <span class="summary_desc"><div class='inline'></div></span>
204
+
205
+ </li>
206
+
207
+
208
+ </ul>
209
+
210
+
211
+
212
+
213
+ <div id="instance_method_details" class="method_details_list">
214
+ <h2>Instance Method Details</h2>
215
+
216
+
217
+ <div class="method_details first">
218
+ <p class="signature first" id="ago_in_words-instance_method">
219
+
220
+ - (<tt>Object</tt>) <strong>ago_in_words</strong>
221
+
222
+
223
+
224
+ <span class="aliases">Also known as:
225
+ <span class="names"><span id='time_ago_in_words-instance_method'>time_ago_in_words</span></span>
226
+ </span>
227
+
228
+ </p><table class="source_code">
229
+ <tr>
230
+ <td>
231
+ <pre class="lines">
232
+
233
+
234
+ 22
235
+ 23
236
+ 24
237
+ 25
238
+ 26
239
+ 27
240
+ 28
241
+ 29
242
+ 30
243
+ 31
244
+ 32
245
+ 33
246
+ 34
247
+ 35
248
+ 36
249
+ 37
250
+ 38
251
+ 39</pre>
252
+ </td>
253
+ <td>
254
+ <pre class="code"><span class="info file"># File 'lib/time-lord.rb', line 22</span>
255
+
256
+ <span class='kw'>def</span> <span class='id ago_in_words'>ago_in_words</span>
257
+
258
+ <span class='comment'># Find the time difference between the time provided and the current time.
259
+ </span> <span class='id difference'>difference</span> <span class='op'>=</span> <span class='id get_time_difference_from'>get_time_difference_from</span> <span class='kw'>self</span>
260
+
261
+ <span class='comment'># Catch less than 1 second differences.
262
+ </span> <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>just now</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id difference'>difference</span> <span class='op'>&lt;</span> <span class='int'>1</span>
263
+
264
+ <span class='id name'>name</span> <span class='op'>=</span> <span class='id get_unit_name_from'>get_unit_name_from</span> <span class='id difference'>difference</span>
265
+ <span class='id amount'>amount</span> <span class='op'>=</span> <span class='id get_unit_amount_from'>get_unit_amount_from</span> <span class='id difference'>difference</span>
266
+ <span class='id count'>count</span> <span class='op'>=</span> <span class='id get_unit_count_from'>get_unit_count_from</span> <span class='id difference'>difference</span><span class='comma'>,</span> <span class='id amount'>amount</span>
267
+
268
+ <span class='comment'># Determine if unit name needs pluralization.
269
+ </span> <span class='id name'>name</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>s</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id count'>count</span> <span class='op'>&gt;</span> <span class='int'>1</span>
270
+
271
+ <span class='comment'># Return the remaining string.
272
+ </span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id count'>count</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> ago</span><span class='tstring_end'>&quot;</span></span>
273
+ <span class='kw'>end</span></pre>
274
+ </td>
275
+ </tr>
276
+ </table>
277
+ </div>
278
+
279
+ </div>
280
+
281
+ </div>
282
+
283
+ <div id="footer">
284
+ Generated on Wed Mar 16 02:14:43 2011 by
285
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
286
+ 0.6.5 (ruby-1.9.2).
287
+ </div>
288
+
289
+ </body>
290
+ </html>
@@ -0,0 +1,93 @@
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Module: TimeLord</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 (T)</a> &raquo;
27
+
28
+
29
+ <span class="title">TimeLord</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>Module: TimeLord
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+ <dt class="r1 last">Defined in:</dt>
62
+ <dd class="r1 last">lib/time-lord/version.rb</dd>
63
+
64
+ </dl>
65
+ <div class="clear"></div>
66
+
67
+
68
+ <h2>Constant Summary</h2>
69
+
70
+ <dl class="constants">
71
+
72
+ <dt id="VERSION-constant" class="">VERSION =
73
+
74
+ </dt>
75
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1.5</span><span class='tstring_end'>&quot;</span></span></pre></dd>
76
+
77
+ </dl>
78
+
79
+
80
+
81
+
82
+
83
+
84
+ </div>
85
+
86
+ <div id="footer">
87
+ Generated on Wed Mar 16 02:14:43 2011 by
88
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
89
+ 0.6.5 (ruby-1.9.2).
90
+ </div>
91
+
92
+ </body>
93
+ </html>