ruby-units 1.1.2 → 1.1.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/CHANGELOG.txt CHANGED
@@ -1,5 +1,6 @@
1
1
  Change Log for Ruby-units
2
2
  =========================
3
+ 2007-12-13 1.1.3 * fixed a minor bug with string %
3
4
  2007-12-12 1.1.2 * fixed a bug with format strings
4
5
  * detect if ruby 1.8.6 is installed and use its' to_date function
5
6
 
@@ -40,7 +40,7 @@ require 'parsedate'
40
40
  # Unit.setup
41
41
  class Unit < Numeric
42
42
  # pre-generate hashes from unit definitions for performance.
43
- VERSION = '1.1.2'
43
+ VERSION = '1.1.3'
44
44
  @@USER_DEFINITIONS = {}
45
45
  @@PREFIX_VALUES = {}
46
46
  @@PREFIX_MAP = {}
@@ -9,10 +9,10 @@ class String
9
9
 
10
10
  # format unit output using formating codes '%0.2f' % '1 mm'.unit => '1.00 mm'
11
11
  def %(*args)
12
- case args[0]
13
- when Unit: args[0].to_s(self)
14
- when (Object.const_defined?('Uncertain') && (Uncertain === args[0])): args[0].to_s(self)
15
- when Complex: args[0].to_s
12
+ case
13
+ when Unit === args[0]: args[0].to_s(self)
14
+ when (!defined?(Uncertain).nil? && (Uncertain === args[0])): args[0].to_s(self)
15
+ when Complex === args[0]: args[0].to_s
16
16
  else
17
17
  unit_format(*args)
18
18
  end
@@ -896,6 +896,7 @@ class TestRubyUnits < Test::Unit::TestCase
896
896
 
897
897
  def test_format_nil_string
898
898
  assert_nothing_raised {"" % nil}
899
+ assert_nothing_raised {"" % false}
899
900
  end
900
901
 
901
902
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ruby-units
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.2
6
+ version: 1.1.3
7
7
  date: 2007-12-13 00:00:00 -05:00
8
8
  summary: A model that performs unit conversions and unit math
9
9
  require_paths: