Hi,
I love ruby,but it seems Ruby don't me. :)
I actually doing some play with nokogiri methods since last 3 days.
Doing so I have ended up with the below code:
require 'nokogiri'
doc = Nokogiri::XML(<<-eohl)
<Stock>
<Code>7052</Code>
<Name>PADINI</Name>
<StockDailyRecords>
<PriceOpen>1.2</PriceOpen>
<PriceChange>1.1</PriceChange>
<PriceClose>10.0</PriceClose>
<Volume>3000000L</Volume>
</StockDailyRecords>
<StockDailyRecords>
<PriceOpen>1.3</PriceOpen>
<PriceChange>1.2</PriceChange>
<PriceClose>11.0</PriceClose>
<Volume>5000000L</Volume>
</StockDailyRecords>
</Stock>
eohl
doc.at_css("StockDailyRecords").children.map{|el| el.text.strip if
el.text.strip != "" }.compact
# => ["1.2", "1.1", "10.0", "3000000L"]
but my code not seems to be a Rubyistic. Any good approach would anybody
give me? :)))
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/06c7f08ef74661fd157133b8daf0c6ef%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.