Wednesday, 28 August 2013

parse numbers ruby on rails

parse numbers ruby on rails

I want to parse some items from another site of mine.
def self.run
...
parsed_response = JSON.parse(response.body)
parsed_response.each do |item|
t = Page.new(:title => item["title"], :body => item["body"],
:format_type => item["format_type"])
t.body.gsub!("Some text", "Other text")
t.save
end
end
In string body there are some numbers and formulas: 120 $; 130 $; 20 $ +
30 $ = 50 $ etc.
I want to add each numbers number 10. But how can I do it?
Even if I add to each number 10, sum in the formula must be greater than
10. So I must remove sum after = and puts calculated sum.
Thanks in advance.

No comments:

Post a Comment