Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_com/core/string.rb

Instance Method Summary collapse

Instance Method Details

#integer?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
# File 'lib/rails_com/core/string.rb', line 3

def integer?
  Integer(self).is_a?(Integer)
rescue ArgumentError, TypeError
  false
end

#numeric?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/rails_com/core/string.rb', line 9

def numeric?
  Float(self).is_a?(Numeric)
rescue ArgumentError, TypeError
  false
end