want to convert this php code to ruby.................

H

HUNT HUNT

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)));
}
}
 
J

Jean-Julien Fleck

2010/3/30 HUNT HUNT said:
function tooltip($el,$content,$options=3Darray()) {
=A0 =A0 =A0 =A0if ( substr($content,0,1)!=3D'$') $content =3D "'$content'= ";
=A0 =A0 =A0 =A0if($options) {
=A0 =A0 =A0 =A0 =A0 =A0return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip['fancy'= ],$el,$content,$this->_parseOptions($options))));
=A0 =A0 =A0 =A0} else {
=A0 =A0 =A0 =A0 =A0 =A0return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip['base']= ,$el,$content)));
=A0 =A0 =A0 =A0}
=A0 =A0}

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=3Dnil)
your_code_goes_here
end

Cheers,

--=20
JJ Fleck
PCSI1 Lyc=E9e Kl=E9ber
 
R

Robert Klemme

2010/3/30 HUNT HUNT said:
function tooltip($el,$content,$options=3Darray()) {
=A0 =A0 =A0 =A0if ( substr($content,0,1)!=3D'$') $content =3D "'$content'= ";
=A0 =A0 =A0 =A0if($options) {
=A0 =A0 =A0 =A0 =A0 =A0return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip['fancy'= ],$el,$content,$this->_parseOptions($options))));
=A0 =A0 =A0 =A0} else {
=A0 =A0 =A0 =A0 =A0 =A0return
$this->Javascript->codeBlock($this->output(sprintf($this->tooltip['base']= ,$el,$content)));
=A0 =A0 =A0 =A0}
=A0 =A0}

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


--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top