facets 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.rdoc +331 -35
- data/MANIFEST +685 -826
- data/{doc/guide/notes.rd → NOTES} +0 -0
- data/README.rdoc +73 -25
- data/Rakefile +245 -2
- data/TODO +5 -0
- data/demo/hook.rd +47 -0
- data/demo/scenario_require.rd +9 -0
- data/doc/README.more +24 -6
- data/doc/manual/about.rb +47 -0
- data/doc/manual/annotations.rdoc +60 -0
- data/doc/manual/associations.rdoc +55 -0
- data/doc/manual/blockups.rdoc +101 -0
- data/doc/manual/capsule.rdoc +34 -0
- data/doc/manual/command.rdoc +177 -0
- data/doc/manual/core.rdoc +37 -0
- data/doc/manual/faq.rdoc +32 -0
- data/doc/manual/typecast.html +112 -0
- data/lib/core/facets.rb +359 -11
- data/lib/core/facets/array/combination.rb +3 -3
- data/lib/core/facets/array/index.rb +4 -1
- data/lib/core/facets/array/permutation.rb +2 -2
- data/lib/core/facets/array/product.rb +1 -1
- data/lib/core/facets/binding/eval.rb +1 -1
- data/lib/core/facets/denumerable.rb +76 -0
- data/lib/core/facets/duplicable.rb +34 -0
- data/lib/core/facets/enumerable/count.rb +10 -4
- data/lib/core/facets/enumerable/defer.rb +77 -0
- data/lib/core/facets/enumerable/each_by.rb +1 -1
- data/lib/core/facets/enumerable/every.rb +35 -0
- data/lib/{more/facets/elementwise.rb → core/facets/enumerable/ewise.rb} +0 -0
- data/lib/core/facets/enumerable/filter.rb +25 -0
- data/lib/core/facets/enumerable/group_by.rb +1 -1
- data/lib/core/facets/enumerable/none.rb +3 -2
- data/lib/core/facets/enumerable/one.rb +3 -2
- data/lib/core/facets/enumerable/per.rb +61 -0
- data/lib/core/facets/exception/raised.rb +14 -0
- data/lib/core/facets/integer/odd.rb +5 -1
- data/lib/core/facets/kernel/__dir__.rb +13 -3
- data/lib/core/facets/kernel/__here__.rb +14 -0
- data/lib/core/facets/kernel/__method__.rb +9 -3
- data/lib/core/facets/kernel/ask.rb +1 -0
- data/lib/core/facets/kernel/equate.rb +13 -0
- data/lib/core/facets/kernel/extension.rb +9 -0
- data/lib/core/facets/kernel/identical.rb +4 -0
- data/lib/core/facets/kernel/instance_exec.rb +2 -1
- data/lib/core/facets/kernel/method.rb +49 -0
- data/lib/core/facets/kernel/object_send.rb +2 -2
- data/lib/core/facets/kernel/{state.rb → object_state.rb} +23 -12
- data/lib/core/facets/kernel/require_all.rb +6 -1
- data/lib/core/facets/kernel/require_local.rb +8 -1
- data/lib/core/facets/kernel/require_relative.rb +52 -0
- data/lib/core/facets/kernel/source_location.rb +13 -0
- data/lib/core/facets/kernel/tap.rb +13 -6
- data/lib/core/facets/module/attr_setter.rb +57 -0
- data/lib/core/facets/module/instance_method.rb +24 -0
- data/lib/core/facets/module/module_load.rb +60 -44
- data/lib/core/facets/module/module_require.rb +1 -0
- data/lib/core/facets/nilclass/to_f.rb +1 -1
- data/lib/core/facets/objectspace/op_fetch.rb +3 -0
- data/lib/core/facets/proc/curry.rb +4 -3
- data/lib/core/facets/string/bytes.rb +10 -4
- data/lib/core/facets/string/camelcase.rb +6 -5
- data/lib/core/facets/string/chars.rb +5 -1
- data/lib/core/facets/string/each_char.rb +1 -1
- data/lib/core/facets/string/each_word.rb +1 -1
- data/lib/core/facets/string/lines.rb +11 -4
- data/lib/core/facets/string/start_with.rb +9 -2
- data/lib/core/facets/string/unfold.rb +27 -0
- data/lib/core/facets/symbol/succ.rb +3 -3
- data/lib/core/facets/symbol/thrown.rb +20 -0
- data/lib/core/facets/symbol/to_proc.rb +3 -2
- data/lib/core/facets/time/to_time.rb +1 -1
- data/lib/core/facets/to_hash.rb +41 -100
- data/lib/core/facets/unboundmethod/name.rb +20 -23
- data/lib/more/facets/ansicode.rb +1 -10
- data/lib/more/facets/autoarray.rb +3 -31
- data/lib/more/facets/basicobject.rb +73 -0
- data/lib/more/facets/blankslate.rb +2 -66
- data/lib/{lore → more}/facets/cgi.rb +0 -0
- data/lib/more/facets/class_extend.rb +1 -0
- data/lib/{lore → more}/facets/continuation.rb +0 -0
- data/lib/{lore → more}/facets/date.rb +3 -3
- data/lib/more/facets/enumargs.rb +192 -0
- data/lib/more/facets/enumerablepass.rb +2 -216
- data/lib/more/facets/enumerator.rb +62 -0
- data/lib/more/facets/{equatable.rb → equitable.rb} +11 -11
- data/lib/more/facets/expirable.rb +13 -41
- data/lib/{lore → more}/facets/fileutils.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/head.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/safe_ln.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/slice.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/tail.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/wc.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/whereis.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/which.rb +0 -0
- data/lib/{lore → more}/facets/getoptlong.rb +0 -0
- data/lib/more/facets/hook.rb +2 -29
- data/lib/more/facets/inheritor.rb +2 -2
- data/lib/more/facets/instance_eval.rb +50 -0
- data/lib/more/facets/instance_function.rb +78 -0
- data/lib/more/facets/main.rb +20 -15
- data/lib/more/facets/memoize.rb +1 -113
- data/lib/more/facets/module/attr.rb +83 -0
- data/lib/more/facets/module/attr_tester.rb +44 -0
- data/lib/more/facets/module/attr_toggler.rb +59 -0
- data/lib/more/facets/module/attr_validator.rb +34 -0
- data/lib/more/facets/{class_extension.rb → module/class_extend.rb} +21 -13
- data/lib/more/facets/once.rb +59 -0
- data/lib/more/facets/openmodule.rb +1 -0
- data/lib/more/facets/orderedhash.rb +1 -33
- data/lib/{lore → more}/facets/ostruct.rb +0 -0
- data/lib/more/facets/ostructable.rb +1 -4
- data/lib/more/facets/partial.rb +18 -16
- data/lib/{lore → more}/facets/pathname.rb +0 -0
- data/lib/more/facets/preinitialize.rb +157 -0
- data/lib/{lore → more}/facets/rbconfig.rb +0 -0
- data/lib/more/facets/recorder.rb +1 -2
- data/lib/{lore → more}/facets/set.rb +0 -0
- data/lib/{lore → more}/facets/shellwords.rb +0 -0
- data/lib/{lore → more}/facets/uri.rb +0 -0
- data/lib/{lore → more}/facets/yaml.rb +0 -0
- data/lib/{lore → more}/facets/zlib.rb +0 -0
- data/meta/loadpath +0 -1
- data/meta/sitemap +4 -0
- data/meta/version +1 -1
- data/test/core/enumerable/test_count.rb +1 -1
- data/test/{more/test_filter.rb → core/enumerable/test_defer.rb} +24 -22
- data/test/{more/test_elementor.rb → core/enumerable/test_every.rb} +2 -15
- data/test/core/enumerable/test_ewise.rb +23 -0
- data/test/core/enumerable/test_per.rb +18 -0
- data/test/core/enumerable/test_take.rb +13 -0
- data/test/core/kernel/test_deepcopy.rb +1 -1
- data/test/{more/test_1stclassmethod.rb → core/kernel/test_method.rb} +2 -7
- data/test/core/kernel/test_tap.rb +1 -1
- data/test/core/proc/test_curry.rb +11 -0
- data/test/core/string/test_bytes.rb +1 -1
- data/test/core/string/test_camelcase.rb +23 -6
- data/test/core/string/test_lines.rb +1 -1
- data/test/core/string/test_unfold.rb +14 -0
- data/test/{more → core}/test_blank.rb +0 -0
- data/test/{more → core}/test_boolean.rb +0 -0
- data/test/{more → core}/test_functor.rb +0 -0
- data/test/{lore → more}/test_basicobject.rb +0 -0
- data/test/more/{test_class_extension.rb → test_class_extend.rb} +6 -6
- data/test/{lore → more}/test_continuation.rb +0 -0
- data/test/{lore → more}/test_date.rb +0 -0
- data/test/more/{test_enumerablepass.rb → test_enumargs.rb} +2 -4
- data/test/more/{test_equatable.rb → test_equitable.rb} +2 -2
- data/test/more/{test_instantise.rb → test_instance_function.rb} +3 -2
- data/test/more/test_memoize.rb +1 -1
- data/test/{lore → more}/test_ostruct.rb +0 -0
- metadata +865 -1016
- data/RELEASE +0 -38
- data/doc/README.lore +0 -51
- data/doc/log/basic_stats/index.html +0 -39
- data/doc/log/changelog.html +0 -648
- data/doc/log/changelog.txt +0 -217
- data/doc/log/stats/index.html +0 -39
- data/doc/log/testlog.txt +0 -278
- data/doc/notes/CHANGES +0 -2529
- data/doc/rdoc/lore/classes/Array.html +0 -176
- data/doc/rdoc/lore/classes/CGI.html +0 -191
- data/doc/rdoc/lore/classes/Config.html +0 -135
- data/doc/rdoc/lore/classes/Continuation.html +0 -113
- data/doc/rdoc/lore/classes/Date.html +0 -631
- data/doc/rdoc/lore/classes/DateTime.html +0 -583
- data/doc/rdoc/lore/classes/Enumerable.html +0 -89
- data/doc/rdoc/lore/classes/Enumerable/Enumerator.html +0 -147
- data/doc/rdoc/lore/classes/File.html +0 -128
- data/doc/rdoc/lore/classes/FileUtils.html +0 -434
- data/doc/rdoc/lore/classes/GetoptLong.html +0 -118
- data/doc/rdoc/lore/classes/GetoptLong/DSL.html +0 -208
- data/doc/rdoc/lore/classes/Kernel.html +0 -135
- data/doc/rdoc/lore/classes/Logger.html +0 -229
- data/doc/rdoc/lore/classes/Logger/Ansicolor.html +0 -277
- data/doc/rdoc/lore/classes/Logger/LogDevice.html +0 -121
- data/doc/rdoc/lore/classes/NilClass.html +0 -119
- data/doc/rdoc/lore/classes/OpenStruct.html +0 -432
- data/doc/rdoc/lore/classes/Pathname.html +0 -353
- data/doc/rdoc/lore/classes/Set.html +0 -117
- data/doc/rdoc/lore/classes/Shellwords.html +0 -111
- data/doc/rdoc/lore/classes/String.html +0 -140
- data/doc/rdoc/lore/classes/Time.html +0 -154
- data/doc/rdoc/lore/classes/URI.html +0 -454
- data/doc/rdoc/lore/classes/URI/Hash.html +0 -105
- data/doc/rdoc/lore/classes/URI/Kernel.html +0 -122
- data/doc/rdoc/lore/classes/Zlib.html +0 -188
- data/doc/rdoc/lore/created.rid +0 -1
- data/doc/rdoc/lore/files/README.html +0 -286
- data/doc/rdoc/lore/files/doc/README_lore.html +0 -155
- data/doc/rdoc/lore/files/lib/lore/facets/basicobject_rb.html +0 -118
- data/doc/rdoc/lore/files/lib/lore/facets/cgi_rb.html +0 -111
- data/doc/rdoc/lore/files/lib/lore/facets/continuation_rb.html +0 -147
- data/doc/rdoc/lore/files/lib/lore/facets/date_rb.html +0 -97
- data/doc/rdoc/lore/files/lib/lore/facets/enumerator_rb.html +0 -111
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/head_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/safe_ln_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/slice_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/tail_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/wc_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/whereis_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/which_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils_rb.html +0 -131
- data/doc/rdoc/lore/files/lib/lore/facets/getoptlong_rb.html +0 -135
- data/doc/rdoc/lore/files/lib/lore/facets/logger_rb.html +0 -142
- data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +0 -135
- data/doc/rdoc/lore/files/lib/lore/facets/pathname_rb.html +0 -145
- data/doc/rdoc/lore/files/lib/lore/facets/rbconfig_rb.html +0 -124
- data/doc/rdoc/lore/files/lib/lore/facets/set_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/shellwords_rb.html +0 -124
- data/doc/rdoc/lore/files/lib/lore/facets/uri_rb.html +0 -125
- data/doc/rdoc/lore/files/lib/lore/facets/yaml_rb.html +0 -146
- data/doc/rdoc/lore/files/lib/lore/facets/zlib_rb.html +0 -97
- data/doc/rdoc/lore/fr_class_index.html +0 -73
- data/doc/rdoc/lore/fr_file_index.html +0 -71
- data/doc/rdoc/lore/fr_method_index.html +0 -177
- data/doc/rdoc/lore/index.html +0 -26
- data/doc/rdoc/lore/rdoc-style.css +0 -177
- data/doc/release-notes/RELEASE-2.0.5 +0 -8
- data/doc/release-notes/RELEASE-2.1.0 +0 -9
- data/doc/release-notes/RELEASE-2.1.1 +0 -5
- data/doc/release-notes/RELEASE-2.1.2 +0 -6
- data/doc/release-notes/RELEASE-2.1.3 +0 -5
- data/doc/release-notes/RELEASE-2.2.0 +0 -14
- data/doc/release-notes/RELEASE-2.2.1 +0 -4
- data/doc/release-notes/RELEASE-2.3.0 +0 -6
- data/doc/release-notes/RELEASE-2.4.0 +0 -70
- data/doc/release-notes/RELEASE-2.4.1 +0 -8
- data/doc/release-notes/RELEASE-2.4.2 +0 -4
- data/doc/release-notes/RELEASE-2.4.3 +0 -78
- data/doc/release-notes/RELEASE-2.4.4 +0 -38
- data/doc/release-notes/RELEASE-2.4.5 +0 -37
- data/doc/release-notes/RELEASE-2.5.0 +0 -83
- data/lib/core/facets/kernel/instance.rb +0 -19
- data/lib/lore/facets/basicobject.rb +0 -14
- data/lib/lore/facets/enumerator.rb +0 -67
- data/lib/lore/facets/logger.rb +0 -291
- data/lib/more/facets/1stclassmethod.rb +0 -140
- data/lib/more/facets/advisable.rb +0 -162
- data/lib/more/facets/association.rb +0 -210
- data/lib/more/facets/attr.rb +0 -209
- data/lib/more/facets/basex.rb +0 -37
- data/lib/more/facets/bbcode.rb +0 -397
- data/lib/more/facets/bicrypt.rb +0 -265
- data/lib/more/facets/binreadable.rb +0 -221
- data/lib/more/facets/censor.rb +0 -97
- data/lib/more/facets/classmethods.rb +0 -199
- data/lib/more/facets/consoleutils.rb +0 -99
- data/lib/more/facets/crypt.rb +0 -166
- data/lib/more/facets/dependency.rb +0 -151
- data/lib/more/facets/downloader.rb +0 -281
- data/lib/more/facets/duplicable.rb +0 -43
- data/lib/more/facets/elementor.rb +0 -133
- data/lib/more/facets/filter.rb +0 -121
- data/lib/more/facets/heap.rb +0 -22
- data/lib/more/facets/infinity.rb +0 -193
- data/lib/more/facets/ini.rb +0 -264
- data/lib/more/facets/instantise.rb +0 -1
- data/lib/more/facets/instantize.rb +0 -95
- data/lib/more/facets/interval.rb +0 -282
- data/lib/more/facets/iteration.rb +0 -65
- data/lib/more/facets/linkedlist.rb +0 -222
- data/lib/more/facets/lrucache.rb +0 -157
- data/lib/more/facets/matcher.rb +0 -140
- data/lib/more/facets/memoizer.rb +0 -74
- data/lib/more/facets/minitar.rb +0 -1063
- data/lib/more/facets/nackclass.rb +0 -41
- data/lib/more/facets/net/smtp_tls.rb +0 -131
- data/lib/more/facets/nilstatus.rb +0 -48
- data/lib/more/facets/overload.rb +0 -94
- data/lib/more/facets/paramix.rb +0 -202
- data/lib/more/facets/pool.rb +0 -91
- data/lib/more/facets/pqueue.rb +0 -449
- data/lib/more/facets/pry.rb +0 -32
- data/lib/more/facets/reflection.rb +0 -145
- data/lib/more/facets/semaphore.rb +0 -92
- data/lib/more/facets/settings.rb +0 -248
- data/lib/more/facets/snapshot.rb +0 -209
- data/lib/more/facets/sparse_array.rb +0 -809
- data/lib/more/facets/string/mask.rb +0 -278
- data/lib/more/facets/string/obfuscate.rb +0 -65
- data/lib/more/facets/string/stylize.rb +0 -169
- data/lib/more/facets/string/words.rb +0 -167
- data/lib/more/facets/syncarray.rb +0 -114
- data/lib/more/facets/synchash.rb +0 -157
- data/lib/more/facets/typecast.rb +0 -261
- data/lib/more/facets/uninheritable.rb +0 -50
- data/lib/more/facets/xmlhash.rb +0 -112
- data/lib/more/facets/xoxo.rb +0 -259
- data/lib/more/facets/ziputils.rb +0 -490
- data/task/conflicts +0 -63
- data/task/coverage.rake +0 -37
- data/task/methods +0 -49
- data/task/rdoc.rake +0 -17
- data/task/setup.rake +0 -38
- data/task/test.rake +0 -145
- data/test/more/test_advisable.rb +0 -71
- data/test/more/test_association.rb +0 -38
- data/test/more/test_bbcode.rb +0 -21
- data/test/more/test_binreadable.rb +0 -50
- data/test/more/test_buildable.rb +0 -73
- data/test/more/test_classmethods.rb +0 -56
- data/test/more/test_crypt.rb +0 -32
- data/test/more/test_dependency.rb +0 -69
- data/test/more/test_elementwise.rb +0 -25
- data/test/more/test_infinity.rb +0 -40
- data/test/more/test_interval.rb +0 -151
- data/test/more/test_linkedlist.rb +0 -41
- data/test/more/test_lrucache.rb +0 -14
- data/test/more/test_overload.rb +0 -160
- data/test/more/test_paramix.rb +0 -170
- data/test/more/test_prototype.rb +0 -35
- data/test/more/test_snapshot.rb +0 -21
- data/test/more/test_sparsearray.rb +0 -279
- data/test/more/test_syncarray.rb +0 -15
- data/test/more/test_synchash.rb +0 -16
- data/test/more/test_typecast.rb +0 -54
- data/test/more/test_uninheritable.rb +0 -31
- data/test/more/test_xoxo.rb +0 -274
- data/test/test_facets.rb +0 -9
@@ -1,583 +0,0 @@
|
|
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
|
-
<html>
|
6
|
-
<head>
|
7
|
-
<title>Class: DateTime</title>
|
8
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
-
|
11
|
-
<script language="JavaScript" type="text/javascript">
|
12
|
-
// <![CDATA[
|
13
|
-
|
14
|
-
function toggleSource( id )
|
15
|
-
{
|
16
|
-
var elem
|
17
|
-
var link
|
18
|
-
|
19
|
-
if( document.getElementById )
|
20
|
-
{
|
21
|
-
elem = document.getElementById( id )
|
22
|
-
link = document.getElementById( "l_" + id )
|
23
|
-
}
|
24
|
-
else if ( document.all )
|
25
|
-
{
|
26
|
-
elem = eval( "document.all." + id )
|
27
|
-
link = eval( "document.all.l_" + id )
|
28
|
-
}
|
29
|
-
else
|
30
|
-
return false;
|
31
|
-
|
32
|
-
if( elem.style.display == "block" )
|
33
|
-
{
|
34
|
-
elem.style.display = "none"
|
35
|
-
link.innerHTML = "+"
|
36
|
-
}
|
37
|
-
else
|
38
|
-
{
|
39
|
-
elem.style.display = "block"
|
40
|
-
link.innerHTML = "-"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function openCode( url )
|
45
|
-
{
|
46
|
-
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
-
}
|
48
|
-
// ]]>
|
49
|
-
</script>
|
50
|
-
</head>
|
51
|
-
|
52
|
-
<body>
|
53
|
-
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
-
<td class="file-title"><span class="file-title-prefix">Class</span><br />DateTime</td>
|
55
|
-
<td align="right">
|
56
|
-
<table cellspacing="0" cellpadding="2">
|
57
|
-
<tr valign="top">
|
58
|
-
<td>In:</td>
|
59
|
-
<td>
|
60
|
-
<a href="../files/lib/lore/facets/date_rb.html">lib/lore/facets/date.rb</a>
|
61
|
-
</td>
|
62
|
-
</tr>
|
63
|
-
<tr>
|
64
|
-
<td>Parent:</td>
|
65
|
-
<td>
|
66
|
-
Object
|
67
|
-
</td>
|
68
|
-
</tr>
|
69
|
-
</table>
|
70
|
-
</td>
|
71
|
-
</tr>
|
72
|
-
</table>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
<div id="content">
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div class="sectiontitle">Methods</div>
|
82
|
-
<span style="padding-right: 5px;"><a href="#M000073">advance</a></span>
|
83
|
-
<span style="padding-right: 5px;"><a href="#M000074">ago</a></span>
|
84
|
-
<span style="padding-right: 5px;"><a href="#M000077">beginning_of_day</a></span>
|
85
|
-
<span style="padding-right: 5px;"><a href="#M000072">change</a></span>
|
86
|
-
<span style="padding-right: 5px;"><a href="#M000079">end_of_day</a></span>
|
87
|
-
<span style="padding-right: 5px;"><a href="#M000081">getutc</a></span>
|
88
|
-
<span style="padding-right: 5px;"><a href="#M000076">in</a></span>
|
89
|
-
<span style="padding-right: 5px;"><a href="#M000066">local_offset</a></span>
|
90
|
-
<span style="padding-right: 5px;"><a href="#M000078">midnight</a></span>
|
91
|
-
<span style="padding-right: 5px;"><a href="#M000071">seconds_since_midnight</a></span>
|
92
|
-
<span style="padding-right: 5px;"><a href="#M000075">since</a></span>
|
93
|
-
<span style="padding-right: 5px;"><a href="#M000070">stamp</a></span>
|
94
|
-
<span style="padding-right: 5px;"><a href="#M000067">to_date</a></span>
|
95
|
-
<span style="padding-right: 5px;"><a href="#M000069">to_datetime</a></span>
|
96
|
-
<span style="padding-right: 5px;"><a href="#M000085">to_f</a></span>
|
97
|
-
<span style="padding-right: 5px;"><a href="#M000068">to_time</a></span>
|
98
|
-
<span style="padding-right: 5px;"><a href="#M000080">utc</a></span>
|
99
|
-
<span style="padding-right: 5px;"><a href="#M000082">utc?</a></span>
|
100
|
-
<span style="padding-right: 5px;"><a href="#M000083">utc_offset</a></span>
|
101
|
-
<span style="padding-right: 5px;"><a href="#M000084">xmlschema</a></span>
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<div class="sectiontitle">Public Class methods</div>
|
109
|
-
<div class="method">
|
110
|
-
<div class="title">
|
111
|
-
<a name="M000066"></a><b>local_offset</b>()
|
112
|
-
</div>
|
113
|
-
<div class="sourcecode">
|
114
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000066_source')" id="l_M000066_source">+</a> ]</p>
|
115
|
-
<div id="M000066_source" class="dyn-source">
|
116
|
-
<pre>
|
117
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 197</span>
|
118
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">local_offset</span>
|
119
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2007</span>).<span class="ruby-identifier">utc_offset</span>.<span class="ruby-identifier">to_r</span> <span class="ruby-operator">/</span> <span class="ruby-value">86400</span>
|
120
|
-
<span class="ruby-keyword kw">end</span>
|
121
|
-
</pre>
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
</div>
|
125
|
-
<div class="sectiontitle">Public Instance methods</div>
|
126
|
-
<div class="method">
|
127
|
-
<div class="title">
|
128
|
-
<a name="M000073"></a><b>advance</b>(options)
|
129
|
-
</div>
|
130
|
-
<div class="description">
|
131
|
-
<p>
|
132
|
-
Uses <a href="Date.html">Date</a> to provide precise <a
|
133
|
-
href="Time.html">Time</a> calculations for years, months, and days. The
|
134
|
-
<tt>options</tt> parameter takes a hash with any of these keys:
|
135
|
-
<tt>:years</tt>, <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>,
|
136
|
-
<tt>:hours</tt>, <tt>:minutes</tt>, <tt>:seconds</tt>.
|
137
|
-
</p>
|
138
|
-
</div>
|
139
|
-
<div class="sourcecode">
|
140
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">+</a> ]</p>
|
141
|
-
<div id="M000073_source" class="dyn-source">
|
142
|
-
<pre>
|
143
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 275</span>
|
144
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">advance</span>(<span class="ruby-identifier">options</span>)
|
145
|
-
<span class="ruby-identifier">d</span> = <span class="ruby-identifier">to_date</span>.<span class="ruby-identifier">advance</span>(<span class="ruby-identifier">options</span>)
|
146
|
-
<span class="ruby-identifier">datetime_advanced_by_date</span> = <span class="ruby-identifier">change</span>(<span class="ruby-identifier">:year</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">year</span>, <span class="ruby-identifier">:month</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">month</span>, <span class="ruby-identifier">:day</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">day</span>)
|
147
|
-
<span class="ruby-identifier">seconds_to_advance</span> = (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:seconds</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:minutes</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:hours</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">*</span> <span class="ruby-value">3600</span>
|
148
|
-
<span class="ruby-identifier">seconds_to_advance</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">datetime_advanced_by_date</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">datetime_advanced_by_date</span>.<span class="ruby-identifier">since</span>(<span class="ruby-identifier">seconds_to_advance</span>)
|
149
|
-
<span class="ruby-keyword kw">end</span>
|
150
|
-
</pre>
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
</div>
|
154
|
-
<div class="method">
|
155
|
-
<div class="title">
|
156
|
-
<a name="M000074"></a><b>ago</b>(seconds)
|
157
|
-
</div>
|
158
|
-
<div class="description">
|
159
|
-
<p>
|
160
|
-
Returns a new <a href="DateTime.html">DateTime</a> representing the time a
|
161
|
-
number of seconds <a href="DateTime.html#M000074">ago</a> Do not use this
|
162
|
-
method <a href="DateTime.html#M000076">in</a> combination with x.months,
|
163
|
-
use months_ago instead!
|
164
|
-
</p>
|
165
|
-
</div>
|
166
|
-
<div class="sourcecode">
|
167
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">+</a> ]</p>
|
168
|
-
<div id="M000074_source" class="dyn-source">
|
169
|
-
<pre>
|
170
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 284</span>
|
171
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ago</span>(<span class="ruby-identifier">seconds</span>)
|
172
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">since</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">seconds</span>)
|
173
|
-
<span class="ruby-keyword kw">end</span>
|
174
|
-
</pre>
|
175
|
-
</div>
|
176
|
-
</div>
|
177
|
-
</div>
|
178
|
-
<div class="method">
|
179
|
-
<div class="title">
|
180
|
-
<a name="M000077"></a><b>beginning_of_day</b>()
|
181
|
-
</div>
|
182
|
-
<div class="description">
|
183
|
-
<p>
|
184
|
-
Returns a new <a href="DateTime.html">DateTime</a> representing the start
|
185
|
-
of the day (0:00)
|
186
|
-
</p>
|
187
|
-
</div>
|
188
|
-
<div class="aka">
|
189
|
-
This method is also aliased as
|
190
|
-
<a href="DateTime.html#M000078">midnight</a>
|
191
|
-
</div>
|
192
|
-
<div class="sourcecode">
|
193
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">+</a> ]</p>
|
194
|
-
<div id="M000077_source" class="dyn-source">
|
195
|
-
<pre>
|
196
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 296</span>
|
197
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginning_of_day</span>
|
198
|
-
<span class="ruby-identifier">change</span>(<span class="ruby-identifier">:hour</span> =<span class="ruby-operator">></span> <span class="ruby-value">0</span>)
|
199
|
-
<span class="ruby-keyword kw">end</span>
|
200
|
-
</pre>
|
201
|
-
</div>
|
202
|
-
</div>
|
203
|
-
</div>
|
204
|
-
<div class="method">
|
205
|
-
<div class="title">
|
206
|
-
<a name="M000072"></a><b>change</b>(options)
|
207
|
-
</div>
|
208
|
-
<div class="description">
|
209
|
-
<p>
|
210
|
-
Returns a new <a href="DateTime.html">DateTime</a> where one or more of the
|
211
|
-
elements have been changed according to the <tt>options</tt> parameter. The
|
212
|
-
time options (hour, minute, sec) reset cascadingly, so if only the hour is
|
213
|
-
passed, then minute and sec is set to 0. If the hour and minute is passed,
|
214
|
-
then sec is set to 0.
|
215
|
-
</p>
|
216
|
-
</div>
|
217
|
-
<div class="sourcecode">
|
218
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000072_source')" id="l_M000072_source">+</a> ]</p>
|
219
|
-
<div id="M000072_source" class="dyn-source">
|
220
|
-
<pre>
|
221
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 258</span>
|
222
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">change</span>(<span class="ruby-identifier">options</span>)
|
223
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(
|
224
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:year</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">year</span>,
|
225
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:month</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">month</span>,
|
226
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:day</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">day</span>,
|
227
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:hour</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">hour</span>,
|
228
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:min</span>] <span class="ruby-operator">||</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:hour</span>] <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min</span>),
|
229
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:sec</span>] <span class="ruby-operator">||</span> ((<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:hour</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:min</span>]) <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sec</span>),
|
230
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:offset</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">offset</span>,
|
231
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:start</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">start</span>
|
232
|
-
)
|
233
|
-
<span class="ruby-keyword kw">end</span>
|
234
|
-
</pre>
|
235
|
-
</div>
|
236
|
-
</div>
|
237
|
-
</div>
|
238
|
-
<div class="method">
|
239
|
-
<div class="title">
|
240
|
-
<a name="M000079"></a><b>end_of_day</b>()
|
241
|
-
</div>
|
242
|
-
<div class="description">
|
243
|
-
<p>
|
244
|
-
Returns a new <a href="DateTime.html">DateTime</a> representing the end of
|
245
|
-
the day (23:59:59)
|
246
|
-
</p>
|
247
|
-
</div>
|
248
|
-
<div class="sourcecode">
|
249
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">+</a> ]</p>
|
250
|
-
<div id="M000079_source" class="dyn-source">
|
251
|
-
<pre>
|
252
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 302</span>
|
253
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">end_of_day</span>
|
254
|
-
<span class="ruby-identifier">change</span>(<span class="ruby-identifier">:hour</span> =<span class="ruby-operator">></span> <span class="ruby-value">23</span>, <span class="ruby-identifier">:min</span> =<span class="ruby-operator">></span> <span class="ruby-value">59</span>, <span class="ruby-identifier">:sec</span> =<span class="ruby-operator">></span> <span class="ruby-value">59</span>)
|
255
|
-
<span class="ruby-keyword kw">end</span>
|
256
|
-
</pre>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
</div>
|
260
|
-
<div class="method">
|
261
|
-
<div class="title">
|
262
|
-
<a name="M000081"></a><b>getutc</b>()
|
263
|
-
</div>
|
264
|
-
<div class="description">
|
265
|
-
<p>
|
266
|
-
Alias for <a href="DateTime.html#M000080">utc</a>
|
267
|
-
</p>
|
268
|
-
</div>
|
269
|
-
</div>
|
270
|
-
<div class="method">
|
271
|
-
<div class="title">
|
272
|
-
<a name="M000076"></a><b>in</b>(seconds)
|
273
|
-
</div>
|
274
|
-
<div class="description">
|
275
|
-
<p>
|
276
|
-
Alias for <a href="DateTime.html#M000075">since</a>
|
277
|
-
</p>
|
278
|
-
</div>
|
279
|
-
</div>
|
280
|
-
<div class="method">
|
281
|
-
<div class="title">
|
282
|
-
<a name="M000078"></a><b>midnight</b>()
|
283
|
-
</div>
|
284
|
-
<div class="description">
|
285
|
-
<p>
|
286
|
-
Alias for <a href="DateTime.html#M000077">beginning_of_day</a>
|
287
|
-
</p>
|
288
|
-
</div>
|
289
|
-
</div>
|
290
|
-
<div class="method">
|
291
|
-
<div class="title">
|
292
|
-
<a name="M000071"></a><b>seconds_since_midnight</b>()
|
293
|
-
</div>
|
294
|
-
<div class="description">
|
295
|
-
<p>
|
296
|
-
Seconds <a href="DateTime.html#M000075">since</a> <a
|
297
|
-
href="DateTime.html#M000078">midnight</a>: DateTime.now.<a
|
298
|
-
href="DateTime.html#M000071">seconds_since_midnight</a>
|
299
|
-
</p>
|
300
|
-
</div>
|
301
|
-
<div class="sourcecode">
|
302
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000071_source')" id="l_M000071_source">+</a> ]</p>
|
303
|
-
<div id="M000071_source" class="dyn-source">
|
304
|
-
<pre>
|
305
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 249</span>
|
306
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seconds_since_midnight</span>
|
307
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sec</span> <span class="ruby-operator">+</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span>) <span class="ruby-operator">+</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">hour</span> <span class="ruby-operator">*</span> <span class="ruby-value">3600</span>)
|
308
|
-
<span class="ruby-keyword kw">end</span>
|
309
|
-
</pre>
|
310
|
-
</div>
|
311
|
-
</div>
|
312
|
-
</div>
|
313
|
-
<div class="method">
|
314
|
-
<div class="title">
|
315
|
-
<a name="M000075"></a><b>since</b>(seconds)
|
316
|
-
</div>
|
317
|
-
<div class="description">
|
318
|
-
<p>
|
319
|
-
Returns a new <a href="DateTime.html">DateTime</a> representing the time a
|
320
|
-
number of seconds <a href="DateTime.html#M000075">since</a> the instance
|
321
|
-
time Do not use this method <a href="DateTime.html#M000076">in</a>
|
322
|
-
combination with x.months, use months_since instead!
|
323
|
-
</p>
|
324
|
-
</div>
|
325
|
-
<div class="aka">
|
326
|
-
This method is also aliased as
|
327
|
-
<a href="DateTime.html#M000076">in</a>
|
328
|
-
</div>
|
329
|
-
<div class="sourcecode">
|
330
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">+</a> ]</p>
|
331
|
-
<div id="M000075_source" class="dyn-source">
|
332
|
-
<pre>
|
333
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 290</span>
|
334
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">since</span>(<span class="ruby-identifier">seconds</span>)
|
335
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Rational</span>(<span class="ruby-identifier">seconds</span>.<span class="ruby-identifier">round</span>, <span class="ruby-value">86400</span>)
|
336
|
-
<span class="ruby-keyword kw">end</span>
|
337
|
-
</pre>
|
338
|
-
</div>
|
339
|
-
</div>
|
340
|
-
</div>
|
341
|
-
<div class="method">
|
342
|
-
<div class="title">
|
343
|
-
<a name="M000070"></a><b>stamp</b>(format=:default)
|
344
|
-
</div>
|
345
|
-
<div class="description">
|
346
|
-
<p>
|
347
|
-
Convert to a formatted string. See Time::FORMAT for predefined formats.
|
348
|
-
</p>
|
349
|
-
<p>
|
350
|
-
This method is aliased to <tt>to_s</tt>.
|
351
|
-
</p>
|
352
|
-
<h3>Examples:</h3>
|
353
|
-
<pre>
|
354
|
-
datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
|
355
|
-
|
356
|
-
datetime.stamp(:db) # => "2007-12-04 00:00:00"
|
357
|
-
datetime.stamp(:db) # => "2007-12-04 00:00:00"
|
358
|
-
datetime.stamp(:number) # => "20071204000000"
|
359
|
-
datetime.stamp(:short) # => "04 Dec 00:00"
|
360
|
-
datetime.stamp(:long) # => "December 04, 2007 00:00"
|
361
|
-
datetime.stamp(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
|
362
|
-
</pre>
|
363
|
-
<h2>Adding your own datetime formats to <a href="DateTime.html#M000070">stamp</a></h2>
|
364
|
-
<p>
|
365
|
-
<a href="DateTime.html">DateTime</a> formats are shared with <a
|
366
|
-
href="Time.html">Time</a>. You can add your own to the Time::FORMAT hash.
|
367
|
-
Use the format name as the hash key and a strftime string as the value. Eg.
|
368
|
-
</p>
|
369
|
-
<pre>
|
370
|
-
Time::FORMAT[:month_and_year] = "%B %Y"
|
371
|
-
</pre>
|
372
|
-
</div>
|
373
|
-
<div class="sourcecode">
|
374
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000070_source')" id="l_M000070_source">+</a> ]</p>
|
375
|
-
<div id="M000070_source" class="dyn-source">
|
376
|
-
<pre>
|
377
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 240</span>
|
378
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stamp</span>(<span class="ruby-identifier">format</span>=<span class="ruby-identifier">:default</span>)
|
379
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">formatter</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-constant">FORMAT</span>[<span class="ruby-identifier">format</span>]
|
380
|
-
<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">formatter</span>)
|
381
|
-
<span class="ruby-keyword kw">else</span>
|
382
|
-
<span class="ruby-identifier">to_s</span>
|
383
|
-
<span class="ruby-keyword kw">end</span>
|
384
|
-
<span class="ruby-keyword kw">end</span>
|
385
|
-
</pre>
|
386
|
-
</div>
|
387
|
-
</div>
|
388
|
-
</div>
|
389
|
-
<div class="method">
|
390
|
-
<div class="title">
|
391
|
-
<a name="M000067"></a><b>to_date</b>()
|
392
|
-
</div>
|
393
|
-
<div class="description">
|
394
|
-
<p>
|
395
|
-
Converts self to a Ruby <a href="Date.html">Date</a> object; time portion
|
396
|
-
is discarded
|
397
|
-
</p>
|
398
|
-
</div>
|
399
|
-
<div class="sourcecode">
|
400
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000067_source')" id="l_M000067_source">+</a> ]</p>
|
401
|
-
<div id="M000067_source" class="dyn-source">
|
402
|
-
<pre>
|
403
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 202</span>
|
404
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_date</span>
|
405
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>)
|
406
|
-
<span class="ruby-keyword kw">end</span>
|
407
|
-
</pre>
|
408
|
-
</div>
|
409
|
-
</div>
|
410
|
-
</div>
|
411
|
-
<div class="method">
|
412
|
-
<div class="title">
|
413
|
-
<a name="M000069"></a><b>to_datetime</b>()
|
414
|
-
</div>
|
415
|
-
<div class="description">
|
416
|
-
<p>
|
417
|
-
To be able to keep Times, Dates and DateTimes interchangeable on
|
418
|
-
conversions
|
419
|
-
</p>
|
420
|
-
</div>
|
421
|
-
<div class="sourcecode">
|
422
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000069_source')" id="l_M000069_source">+</a> ]</p>
|
423
|
-
<div id="M000069_source" class="dyn-source">
|
424
|
-
<pre>
|
425
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 215</span>
|
426
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_datetime</span>
|
427
|
-
<span class="ruby-keyword kw">self</span>
|
428
|
-
<span class="ruby-keyword kw">end</span>
|
429
|
-
</pre>
|
430
|
-
</div>
|
431
|
-
</div>
|
432
|
-
</div>
|
433
|
-
<div class="method">
|
434
|
-
<div class="title">
|
435
|
-
<a name="M000085"></a><b>to_f</b>()
|
436
|
-
</div>
|
437
|
-
<div class="description">
|
438
|
-
<p>
|
439
|
-
Converts self to a floating-point number of seconds <a
|
440
|
-
href="DateTime.html#M000075">since</a> the Unix epoch
|
441
|
-
</p>
|
442
|
-
</div>
|
443
|
-
<div class="sourcecode">
|
444
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">+</a> ]</p>
|
445
|
-
<div id="M000085_source" class="dyn-source">
|
446
|
-
<pre>
|
447
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 333</span>
|
448
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_f</span>
|
449
|
-
<span class="ruby-identifier">days_since_unix_epoch</span> = <span class="ruby-keyword kw">self</span> <span class="ruby-operator">-</span> <span class="ruby-operator">::</span><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1970</span>)
|
450
|
-
(<span class="ruby-identifier">days_since_unix_epoch</span> <span class="ruby-operator">*</span> <span class="ruby-value">86_400</span>).<span class="ruby-identifier">to_f</span>
|
451
|
-
<span class="ruby-keyword kw">end</span>
|
452
|
-
</pre>
|
453
|
-
</div>
|
454
|
-
</div>
|
455
|
-
</div>
|
456
|
-
<div class="method">
|
457
|
-
<div class="title">
|
458
|
-
<a name="M000068"></a><b>to_time</b>()
|
459
|
-
</div>
|
460
|
-
<div class="description">
|
461
|
-
<p>
|
462
|
-
Attempts to convert self to a Ruby <a href="Time.html">Time</a> object;
|
463
|
-
returns self if out of range of Ruby <a href="Time.html">Time</a> class, If
|
464
|
-
self has an offset other than 0, self will just be returned unaltered, <a
|
465
|
-
href="DateTime.html#M000075">since</a> there‘s no clean way to map it
|
466
|
-
to a <a href="Time.html">Time</a>
|
467
|
-
</p>
|
468
|
-
</div>
|
469
|
-
<div class="sourcecode">
|
470
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000068_source')" id="l_M000068_source">+</a> ]</p>
|
471
|
-
<div id="M000068_source" class="dyn-source">
|
472
|
-
<pre>
|
473
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 210</span>
|
474
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_time</span>
|
475
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">offset</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>
|
476
|
-
<span class="ruby-keyword kw">end</span>
|
477
|
-
</pre>
|
478
|
-
</div>
|
479
|
-
</div>
|
480
|
-
</div>
|
481
|
-
<div class="method">
|
482
|
-
<div class="title">
|
483
|
-
<a name="M000080"></a><b>utc</b>()
|
484
|
-
</div>
|
485
|
-
<div class="description">
|
486
|
-
<p>
|
487
|
-
Adjusts <a href="DateTime.html">DateTime</a> to UTC by adding its offset
|
488
|
-
value; offset is set to 0
|
489
|
-
</p>
|
490
|
-
<p>
|
491
|
-
Example:
|
492
|
-
</p>
|
493
|
-
<pre>
|
494
|
-
DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
|
495
|
-
DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 +0000
|
496
|
-
</pre>
|
497
|
-
</div>
|
498
|
-
<div class="aka">
|
499
|
-
This method is also aliased as
|
500
|
-
<a href="DateTime.html#M000081">getutc</a>
|
501
|
-
</div>
|
502
|
-
<div class="sourcecode">
|
503
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">+</a> ]</p>
|
504
|
-
<div id="M000080_source" class="dyn-source">
|
505
|
-
<pre>
|
506
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 312</span>
|
507
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">utc</span>
|
508
|
-
<span class="ruby-identifier">new_offset</span>(<span class="ruby-value">0</span>)
|
509
|
-
<span class="ruby-keyword kw">end</span>
|
510
|
-
</pre>
|
511
|
-
</div>
|
512
|
-
</div>
|
513
|
-
</div>
|
514
|
-
<div class="method">
|
515
|
-
<div class="title">
|
516
|
-
<a name="M000082"></a><b>utc?</b>()
|
517
|
-
</div>
|
518
|
-
<div class="description">
|
519
|
-
<p>
|
520
|
-
Returns true if offset == 0
|
521
|
-
</p>
|
522
|
-
</div>
|
523
|
-
<div class="sourcecode">
|
524
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">+</a> ]</p>
|
525
|
-
<div id="M000082_source" class="dyn-source">
|
526
|
-
<pre>
|
527
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 318</span>
|
528
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">utc?</span>
|
529
|
-
<span class="ruby-identifier">offset</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
530
|
-
<span class="ruby-keyword kw">end</span>
|
531
|
-
</pre>
|
532
|
-
</div>
|
533
|
-
</div>
|
534
|
-
</div>
|
535
|
-
<div class="method">
|
536
|
-
<div class="title">
|
537
|
-
<a name="M000083"></a><b>utc_offset</b>()
|
538
|
-
</div>
|
539
|
-
<div class="description">
|
540
|
-
<p>
|
541
|
-
Returns the offset value <a href="DateTime.html#M000076">in</a> seconds
|
542
|
-
</p>
|
543
|
-
</div>
|
544
|
-
<div class="sourcecode">
|
545
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">+</a> ]</p>
|
546
|
-
<div id="M000083_source" class="dyn-source">
|
547
|
-
<pre>
|
548
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 323</span>
|
549
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">utc_offset</span>
|
550
|
-
(<span class="ruby-identifier">offset</span> <span class="ruby-operator">*</span> <span class="ruby-value">86400</span>).<span class="ruby-identifier">to_i</span>
|
551
|
-
<span class="ruby-keyword kw">end</span>
|
552
|
-
</pre>
|
553
|
-
</div>
|
554
|
-
</div>
|
555
|
-
</div>
|
556
|
-
<div class="method">
|
557
|
-
<div class="title">
|
558
|
-
<a name="M000084"></a><b>xmlschema</b>()
|
559
|
-
</div>
|
560
|
-
<div class="description">
|
561
|
-
<p>
|
562
|
-
Converts datetime to an appropriate format for use <a
|
563
|
-
href="DateTime.html#M000076">in</a> XML
|
564
|
-
</p>
|
565
|
-
</div>
|
566
|
-
<div class="sourcecode">
|
567
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">+</a> ]</p>
|
568
|
-
<div id="M000084_source" class="dyn-source">
|
569
|
-
<pre>
|
570
|
-
<span class="ruby-comment cmt"># File lib/lore/facets/date.rb, line 328</span>
|
571
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xmlschema</span>
|
572
|
-
<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%Y-%m-%dT%H:%M:%S%Z"</span>)
|
573
|
-
<span class="ruby-keyword kw">end</span>
|
574
|
-
</pre>
|
575
|
-
</div>
|
576
|
-
</div>
|
577
|
-
</div>
|
578
|
-
</div>
|
579
|
-
|
580
|
-
</div>
|
581
|
-
|
582
|
-
</body>
|
583
|
-
</html>
|