si 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -48,6 +48,9 @@ Or install it yourself as:
48
48
 
49
49
  ```ruby
50
50
  9876543210000.si(:length => 5) # '9.8765T'
51
+
52
+ # For convenience, a single Fixnum is recognized as :length value
53
+ 9876543210000.si(5) # '9.8765T'
51
54
  ```
52
55
 
53
56
  ### `si_byte`
data/lib/si.rb CHANGED
@@ -12,6 +12,7 @@ module SI
12
12
  }
13
13
 
14
14
  def si options = {}
15
+ options = { :length => options } if options.is_a?(Fixnum) && options >= 3
15
16
  options = DEFAULT.merge(options)
16
17
  length,
17
18
  min_exp,
@@ -1,3 +1,3 @@
1
1
  module SI
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -176,5 +176,9 @@ class TestSI < Test::Unit::TestCase
176
176
  def test_edge_cases
177
177
  assert_equal '9.0000T', 9000000000001.si(:length => 5)
178
178
  end
179
+
180
+ def test_shortcut
181
+ assert_equal '123.5M', 123450000.si(4)
182
+ end
179
183
  end
180
184
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: si
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: