Class: String

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

Instance Method Summary collapse

Instance Method Details

#to_valObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/basilik/core_ext/string.rb', line 2

def to_val
  if self =~ /\A[-+]?\d+$/
    Integer( self )
  elsif self =~ /\A[-+]?\d+\.\d+$/
    Float( self )
  elsif self =~ /false/
    false
  elsif self =~ /true/
    true
  else
    self
  end
end