lib/cellularity/esn.rb in cellularity-0.0.2 vs lib/cellularity/esn.rb in cellularity-0.0.2.1
- old
+ new
@@ -13,10 +13,11 @@
return is_valid_hexadecimal_without_prefix? if self.esn.length == 8
false
end
def is_valid_decimal?
- !!Integer(self.esn)
+ # Remove leading zeros so Integer doesn't think it's an octal.
+ !!Integer(self.esn.gsub(/^0+/, ''))
rescue ArgumentError, TypeError
false
end
def is_valid_hexadecimal_with_prefix?
\ No newline at end of file