mack_ruby_core_extensions 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Float.html +4 -4
- data/doc/created.rid +1 -1
- data/doc/files/lib/extensions/float_rb.html +1 -1
- data/doc/files/lib/mack_ruby_core_extensions_rb.html +1 -1
- data/lib/extensions/float.rb +2 -0
- data/lib/mack_ruby_core_extensions.rb +1 -1
- data/test/extensions/float_test.rb +2 -8
- metadata +1 -1
data/doc/classes/Float.html
CHANGED
@@ -124,10 +124,10 @@
|
|
124
124
|
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
125
125
|
<div class="method-source-code" id="M000019-source">
|
126
126
|
<pre>
|
127
|
-
<span class="ruby-comment cmt"># File lib/extensions/float.rb, line
|
128
|
-
|
129
|
-
|
130
|
-
|
127
|
+
<span class="ruby-comment cmt"># File lib/extensions/float.rb, line 3</span>
|
128
|
+
3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prec</span>(<span class="ruby-identifier">x</span>)
|
129
|
+
4: <span class="ruby-identifier">sprintf</span>(<span class="ruby-node">"%01.#{x}f"</span>, <span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">to_f</span>
|
130
|
+
5: <span class="ruby-keyword kw">end</span>
|
131
131
|
</pre>
|
132
132
|
</div>
|
133
133
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Tue, 25 Mar 2008 17:
|
1
|
+
Tue, 25 Mar 2008 17:57:35 -0400
|
data/lib/extensions/float.rb
CHANGED
@@ -2,6 +2,6 @@
|
|
2
2
|
require "utils/#{k}"
|
3
3
|
end
|
4
4
|
|
5
|
-
[:array, :class, :
|
5
|
+
[:array, :class, :float, :hash, :kernel, :logger, :math, :method_not_implemented, :module, :nil, :object, :string, :symbol].each do |k|
|
6
6
|
require "extensions/#{k}"
|
7
7
|
end
|
@@ -2,14 +2,8 @@ require File.dirname(__FILE__) + '/../test_helper.rb'
|
|
2
2
|
|
3
3
|
class FloatTest < Test::Unit::TestCase
|
4
4
|
|
5
|
-
def
|
5
|
+
def test_prec
|
6
|
+
assert_equal 1.1, 1.1234.prec(1)
|
6
7
|
end
|
7
8
|
|
8
|
-
def teardown
|
9
|
-
end
|
10
|
-
|
11
|
-
# replace this with tests of your own.
|
12
|
-
def test_truth
|
13
|
-
assert true
|
14
|
-
end
|
15
9
|
end
|