Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mark some code as not covered by in ruby 1.9

  • Loading branch information...
commit 66629216939db9c6b2c5af8ebc38ee6c32b357b0 1 parent 70240c0
@olbrich authored
Showing with 6 additions and 0 deletions.
  1. +2 −0  lib/ruby_units/date.rb
  2. +4 −0 lib/ruby_units/unit.rb
View
2  lib/ruby_units/date.rb
@@ -38,12 +38,14 @@ def to_unit(other = nil)
end
alias :unit :to_unit
+ # :nocov_19:
unless Date.instance_methods.include?(:to_time)
# @return [Time]
def to_time
Time.local(*ParseDate.parsedate(self.to_s))
end
end
+ # :nocov_19:
alias :units_datetime_inspect :inspect
# @deprecated
View
4 lib/ruby_units/unit.rb
@@ -1371,6 +1371,7 @@ def parse(passed_unit_string="0")
unit_string.gsub!(/#/,'pound')
#:nocov:
+ #:nocov_19:
if defined?(Uncertain) && unit_string =~ /(\+\/-|±)/
value, uncertainty, unit_s = unit_string.scan(UNCERTAIN_REGEX)[0]
result = unit_s.unit * Uncertain.new(value.to_f,uncertainty.to_f)
@@ -1378,6 +1379,7 @@ def parse(passed_unit_string="0")
return
end
#:nocov:
+ #:nocov_19:
if defined?(Complex) && unit_string =~ COMPLEX_NUMBER
real, imaginary, unit_s = unit_string.scan(COMPLEX_REGEX)[0]
@@ -1502,7 +1504,9 @@ def self.parse_into_numbers_and_units(string)
if num.respond_to?(:to_c)
num.to_c
else
+ #:nocov_19:
Complex(*num.scan(/(#{sci})(#{sci})i/).flatten.map {|n| n.to_i})
+ #:nocov_19:
end
when rational
Rational(*num.split("/").map {|x| x.to_i})
Please sign in to comment.
Something went wrong with that request. Please try again.