Class: String

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

Instance Method Summary collapse

Instance Method Details

#only_digits?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/molten_core/string.rb', line 2

def only_digits?
  self.match /^\d+$/
end

#to_strict_i(base = 10) ⇒ Object



6
7
8
# File 'lib/molten_core/string.rb', line 6

def to_strict_i(base = 10)
  self.only_digits? ? self.to_i(base) : nil
end