Html output for variables

To create a graph i am passing table like bellow

<td class=“graphable” id=“absolute:data:data1:”>9

10 '

now problem is, the value comes from variables like this :

but when i use this variables inside ’ ', its coming as a text like

<td class=“graphable”
id=“absolute:data:data1:”>#{hash[“1”]} <td class=“graphable”
id=“absolute:data:data1:” >#{hash[“1”]}

how do i convert it to value ??

i might be very silly but i am not seeing any light!!
thanks for help

You normally need to use double-quoted strings to use interpolation.
However, since your string contains double-quotes, I would recommend
using a heredoc or using %Q

<td class=“graphable”
id=“absolute:data:data1:”>#{hash[“1”]} <td class=“graphable”
id=“absolute:data:data1:” >#{hash[“1”]}


i just tried that, its works but problem is,
its removing “” from html example when its generating the page, if i see
view source , i see this


but in the html page it should come like this


does it make sense ??

reason, to create a graph by using this gaphable, that needs to be
inside “”

please advise… i am stuck …

Some thing like perl


RX-bytes<td class=“graphable”
.“ RX-packets<td class=“graphable”

same type of concept for ruby …

hope it make sense …

The interpolation should be fine, as demonstrated below. Presumably
whatever you’re using to create the html file is removing your quotes,
but you haven’t given any information on that process.

1:0> hash = {‘1’ => ‘test’}
=> {“1”=>“test”}
2:0> htmloutput=%Q|
3:0" <td class=“graphable”
4:0" id=“absolute:data:data1:”>#{hash[“1”]} <td class=“graphable”
5:0" id=“absolute:data:data1:” >#{hash[“1”]}
6:0" |
7:0> puts htmloutput

        <td class="graphable"



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs