eymiha 1.0.2 → 1.0.3

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.
data/gem_package.rb CHANGED
@@ -4,7 +4,7 @@ class GemPackage
4
4
 
5
5
  def initialize
6
6
  @name = 'eymiha'
7
- @version = '1.0.2'
7
+ @version = '1.0.3'
8
8
  @files = FileList[
9
9
  '*.rb',
10
10
  'lib/*',
data/lib/eymiha.rb CHANGED
@@ -112,3 +112,21 @@ class Array
112
112
  end
113
113
 
114
114
  end
115
+
116
+
117
+ # Provides a determination of the precision of Ruby Time values
118
+ class Time
119
+
120
+ @@subsecond_precision = nil
121
+
122
+ # Returns the actual number of digits of precision of less-than-second values.
123
+ def self.subsecond_precision
124
+ @@subsecond_precision ||=
125
+ (1..5).collect {
126
+ sleep 0.001001
127
+ s = "#{Time.now.usec}"
128
+ s.length - (/[1-9]/ =~ s.reverse)
129
+ }.max
130
+ end
131
+
132
+ end
data/test/tc_eymiha.rb CHANGED
@@ -119,4 +119,12 @@ class TC_class_attr < Test::Unit::TestCase
119
119
  assert(a.to_s2 == "'access2'")
120
120
  end
121
121
 
122
+ def test_time_subsecond_precision
123
+ case Config::CONFIG["target_vendor"]
124
+ when 'apple' then assert(Time.subsecond_precision == 6)
125
+ when 'pc' then assert(Time.subsecond_precision == 3)
126
+ else assert(Time.subsecond_precision > 0)
127
+ end
128
+ end
129
+
122
130
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: eymiha
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.2
7
- date: 2008-05-16 00:00:00 -04:00
6
+ version: 1.0.3
7
+ date: 2008-05-22 00:00:00 -04:00
8
8
  summary: Eymiha general Ruby extensions
9
9
  require_paths:
10
10
  - lib
@@ -33,35 +33,6 @@ files:
33
33
  - rakefile.rb
34
34
  - lib/eymiha.rb
35
35
  - test/tc_eymiha.rb
36
- - html/classes
37
- - html/classes/Array.html
38
- - html/classes/Array.src
39
- - html/classes/Array.src/M000001.html
40
- - html/classes/File.html
41
- - html/classes/File.src
42
- - html/classes/File.src/M000009.html
43
- - html/classes/Hash.html
44
- - html/classes/Hash.src
45
- - html/classes/Hash.src/M000002.html
46
- - html/classes/Module.html
47
- - html/classes/Module.src
48
- - html/classes/Module.src/M000003.html
49
- - html/classes/Module.src/M000004.html
50
- - html/classes/Module.src/M000005.html
51
- - html/classes/Object.html
52
- - html/classes/Object.src
53
- - html/classes/Object.src/M000006.html
54
- - html/classes/Object.src/M000007.html
55
- - html/classes/Object.src/M000008.html
56
- - html/created.rid
57
- - html/files
58
- - html/files/lib
59
- - html/files/lib/eymiha_rb.html
60
- - html/fr_class_index.html
61
- - html/fr_file_index.html
62
- - html/fr_method_index.html
63
- - html/index.html
64
- - html/rdoc-style.css
65
36
  test_files: []
66
37
 
67
38
  rdoc_options:
@@ -1,161 +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
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Array</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">Array</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/eymiha_rb.html">
59
- lib/eymiha.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="Object.html">
69
- Object
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
- Provides a ruby-oriented array conversion.
86
- </p>
87
-
88
- </div>
89
-
90
-
91
- </div>
92
-
93
- <div id="method-list">
94
- <h3 class="section-bar">Methods</h3>
95
-
96
- <div class="name-list">
97
- <a href="#M000001">to_s</a>&nbsp;&nbsp;
98
- </div>
99
- </div>
100
-
101
- </div>
102
-
103
-
104
- <!-- if includes -->
105
-
106
- <div id="section">
107
-
108
-
109
-
110
- <div id="aliases-list">
111
- <h3 class="section-bar">External Aliases</h3>
112
-
113
- <div class="name-list">
114
- <table summary="aliases">
115
- <tr class="top-aligned-row context-row">
116
- <td class="context-item-name">to_s</td>
117
- <td>-&gt;</td>
118
- <td class="context-item-value">to_s_old</td>
119
- </tr>
120
- </table>
121
- </div>
122
- </div>
123
-
124
-
125
-
126
-
127
-
128
- <!-- if method_list -->
129
- <div id="methods">
130
- <h3 class="section-bar">Public Instance methods</h3>
131
-
132
- <div id="method-M000001" class="method-detail">
133
- <a name="M000001"></a>
134
-
135
- <div class="method-heading">
136
- <a href="Array.src/M000001.html" target="Code" class="method-signature"
137
- onclick="popupCode('Array.src/M000001.html');return false;">
138
- <span class="method-name">to_s</span><span class="method-args">()</span>
139
- </a>
140
- </div>
141
-
142
- <div class="method-description">
143
- <p>
144
- a simple string conversion for arrays.
145
- </p>
146
- </div>
147
- </div>
148
-
149
-
150
- </div>
151
-
152
-
153
- </div>
154
-
155
-
156
- <div id="validator-badges">
157
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
158
- </div>
159
-
160
- </body>
161
- </html>
@@ -1,20 +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
-
6
- <html>
7
- <head>
8
- <title>to_s (Array)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/eymiha.rb, line 110</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>()
15
- <span class="ruby-identifier">strings</span> = []
16
- <span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">member</span><span class="ruby-operator">|</span> <span class="ruby-identifier">strings</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{member}&quot;</span> }
17
- <span class="ruby-node">&quot;[ #{strings.join &quot;, &quot;} ]&quot;</span>
18
- <span class="ruby-keyword kw">end</span></pre>
19
- </body>
20
- </html>
@@ -1,142 +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
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: File</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">File</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/eymiha_rb.html">
59
- lib/eymiha.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="Object.html">
69
- Object
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
-
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="#M000009">home_directory</a>&nbsp;&nbsp;
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 Class methods</h3>
112
-
113
- <div id="method-M000009" class="method-detail">
114
- <a name="M000009"></a>
115
-
116
- <div class="method-heading">
117
- <a href="File.src/M000009.html" target="Code" class="method-signature"
118
- onclick="popupCode('File.src/M000009.html');return false;">
119
- <span class="method-name">home_directory</span><span class="method-args">()</span>
120
- </a>
121
- </div>
122
-
123
- <div class="method-description">
124
- <p>
125
- Returns a string containing the user&#8216;s home directory.
126
- </p>
127
- </div>
128
- </div>
129
-
130
-
131
- </div>
132
-
133
-
134
- </div>
135
-
136
-
137
- <div id="validator-badges">
138
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
139
- </div>
140
-
141
- </body>
142
- </html>
@@ -1,24 +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
-
6
- <html>
7
- <head>
8
- <title>home_directory (File)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/eymiha.rb, line 36</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">home_directory</span>
15
- <span class="ruby-identifier">home</span> =
16
- <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-value str">'target_vendor'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'pc'</span>
17
- <span class="ruby-node">&quot;#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH'].gsub(/\\/,File::SEPARATOR)}&quot;</span>
18
- <span class="ruby-keyword kw">else</span>
19
- <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'HOME'</span>]
20
- <span class="ruby-keyword kw">end</span>
21
- <span class="ruby-node">&quot;#{home}#{File::SEPARATOR}&quot;</span>
22
- <span class="ruby-keyword kw">end</span></pre>
23
- </body>
24
- </html>
@@ -1,161 +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
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Hash</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">Hash</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/eymiha_rb.html">
59
- lib/eymiha.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="Object.html">
69
- Object
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
- Provides simple a ruby-oriented string conversion.
86
- </p>
87
-
88
- </div>
89
-
90
-
91
- </div>
92
-
93
- <div id="method-list">
94
- <h3 class="section-bar">Methods</h3>
95
-
96
- <div class="name-list">
97
- <a href="#M000002">to_s</a>&nbsp;&nbsp;
98
- </div>
99
- </div>
100
-
101
- </div>
102
-
103
-
104
- <!-- if includes -->
105
-
106
- <div id="section">
107
-
108
-
109
-
110
- <div id="aliases-list">
111
- <h3 class="section-bar">External Aliases</h3>
112
-
113
- <div class="name-list">
114
- <table summary="aliases">
115
- <tr class="top-aligned-row context-row">
116
- <td class="context-item-name">to_s</td>
117
- <td>-&gt;</td>
118
- <td class="context-item-value">to_s_old</td>
119
- </tr>
120
- </table>
121
- </div>
122
- </div>
123
-
124
-
125
-
126
-
127
-
128
- <!-- if method_list -->
129
- <div id="methods">
130
- <h3 class="section-bar">Public Instance methods</h3>
131
-
132
- <div id="method-M000002" class="method-detail">
133
- <a name="M000002"></a>
134
-
135
- <div class="method-heading">
136
- <a href="Hash.src/M000002.html" target="Code" class="method-signature"
137
- onclick="popupCode('Hash.src/M000002.html');return false;">
138
- <span class="method-name">to_s</span><span class="method-args">()</span>
139
- </a>
140
- </div>
141
-
142
- <div class="method-description">
143
- <p>
144
- a simple string conversion for hashes.
145
- </p>
146
- </div>
147
- </div>
148
-
149
-
150
- </div>
151
-
152
-
153
- </div>
154
-
155
-
156
- <div id="validator-badges">
157
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
158
- </div>
159
-
160
- </body>
161
- </html>
@@ -1,20 +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
-
6
- <html>
7
- <head>
8
- <title>to_s (Hash)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/eymiha.rb, line 95</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
15
- <span class="ruby-identifier">strings</span> = []
16
- <span class="ruby-identifier">each_pair</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">strings</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{key} =&gt; #{value}&quot;</span> }
17
- <span class="ruby-node">&quot;{ #{strings.join &quot;, &quot;} }&quot;</span>
18
- <span class="ruby-keyword kw">end</span></pre>
19
- </body>
20
- </html>