lib/ayadn/extend.rb in ayadn-1.8.2 vs lib/ayadn/extend.rb in ayadn-2.0
- old
+ new
@@ -1,8 +1,15 @@
# encoding: utf-8
class String
def is_integer?
- self.to_i.to_s == self
+ begin
+ temp = self.to_i.to_s
+ return false if temp == "0"
+ Integer(temp)
+ return true
+ rescue ArgumentError
+ return false
+ end
end
end
class Integer
def to_filesize
{