Google

def Functions::string( object=nil ) #object = @context unless object if object.kind_of? Array string( object[0] ) elsif object.kind_of? Text object.to_s elsif object.kind_of? Element object.name else object.to_s end end