boolean( object=nil )public
UNTESTED
# File lib/rexml/functions.rb, line 296
def Functions::boolean( object=nil )
if object.kind_of? String
if object =~ /\d+/
return object.to_f != 0
else
return object.size > 0
end
elsif object.kind_of? Array
object = object.find{|x| x and true}
end
return object ? true : false
end Related methods
- Class methods
- boolean
- ceiling
- compare_language
- concat
- contains
- context=
- count
- false
- floor
- get_namespace
- id
- lang
- last
- local_name
- name
- namespace_context
- namespace_context=
- namespace_uri
- normalize_space
- not
- number
- position
- processing_instruction
- round
- send
- singleton_method_added
- starts_with
- string
- string_length
- string_value
- substring
- substring_after
- substring_before
- sum
- text
- translate
- true
- variables
- variables=