lib/string_ext.rb in yawast-0.7.0.beta1 vs lib/string_ext.rb in yawast-0.7.0.beta2
- old
+ new
@@ -1,14 +1,20 @@
+# frozen_string_literal: true
+
class String
- #see if string is numeric
+ # see if string is numeric
def is_number?
- true if Float(self) rescue false
+ begin
+ true if Float(self)
+ rescue # rubocop:disable Style/RescueStandardError
+ false
+ end
end
def trim
- trimmed = self.strip
+ trimmed = strip
- if trimmed == nil
+ if trimmed.nil?
self
else
trimmed
end
end