Rilcon42 Rilcon42 - 1 year ago 68
Ruby Question

ruby object to_s gives unexpected output

What is the correct way to view the output of the

statements below? My apologies for such a simple question.... Im a little rusty on ruby. github repo

require 'active_support'
require 'active_support/core_ext'
require 'indicators'

my_data = => 'AAPL', :start_date => '2012-08-25', :end_date => '2012-08-30').output)

puts my_data.to_s #expected to see Open,High,Low,Close for AAPL
temp=my_data.calc(:type => :sma, :params => 3)

puts temp.to_s #expected to see an RSI value for each data point from the data above

Answer Source

Just use .inspect method instead of .to_s if you want to see internal properties of objects.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download