Want to convert this php code to ruby

function tooltip($el,$content,$options=array()) {
if ( substr($content,0,1)!=’$’) $content = “’$content’”;
if($options) {
return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip[‘fancy’],$el,$content,$this->_parseOptions($options))));
} else {
return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip[‘base’],$el,$content)));
}
}

2010/3/30 HUNT HUNT [email protected]:

function tooltip($el,$content,$options=array()) {
if ( substr($content,0,1)!=‘$’) $content = “‘$content’”;
if($options) {
return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip[‘fancy’],$el,$content,$this->_parseOptions($options))));
} else {
return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip[‘base’],$el,$content)));
}
}

My advice: try to do it yourself first and post back when you are
stuck somewhere, explaining what you’ve tried and what went wrong.

Hint: it should looks like

def tooltip(el,content,options=nil)
your_code_goes_here
end

Cheers,

2010/3/30 HUNT HUNT [email protected]:

function tooltip($el,$content,$options=array()) {
if ( substr($content,0,1)!=‘$’) $content = “‘$content’”;
if($options) {
return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip[‘fancy’],$el,$content,$this->_parseOptions($options))));
} else {
return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip[‘base’],$el,$content)));
}
}

Now that you have announced that you want to convert this PHP code to
Ruby we’ll eagerly await your posting with the outcome.

Kind regards

robert