Search code examples
rubyindicator

ruby object to_s gives unexpected output


What is the correct way to view the output of the puts 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 = Indicators::Data.new(Securities::Stock.new(:symbol => '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

Solution

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