Class: String

Inherits:
Object
  • Object
show all
Defined in:
C:/Program Files/Relyze/lib/relyze/core.rb

Instance Method Summary collapse

Instance Method Details

#to_boolObject

Raises:

  • (::ArgumentError)


28
29
30
31
32
33
34
35
# File 'C:/Program Files/Relyze/lib/relyze/core.rb', line 28

def to_bool
	if( self =~ /^(true|yes|1)$/i )
		return true
	elsif( self.empty? || self =~ /^(false|no|0)$/i)
		return false
	end
	raise ::ArgumentError.new( "Invalid boolean value '%s'" % self )
end
/body>