Misleading variable value

I’m going to invoke action view base from console, passing a string
object:

1.9.3p0 :016 > ActionView::Base.new(‘app/views’)

=> #<ActionView::Base:0x007fd95c5e8f48 @_config={},
@view_renderer=#<ActionView::Renderer:0x007fd95c5e8c50
@lookup_context=#<ActionView::LookupContext:0x007fd95c5e8ed0
@details_key=nil,
@details={:handlers=>[:erb, :builder, :coffee], :formats=>[:html, :text,
:js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form,
:url_encoded_form, :json], :locale=>[:en, :en]},
@skip_default_locale=false, @frozen_formats=false, @cache=true,
@prefixes=[], @view_paths=[/Users/johnmerlino/github/my_diet/app/
views]>>, @_assigns={}, @_controller=nil,
@view_flow=#<ActionView::OutputFlow:0x007fd95c5e8c28 @content={}>,
@output_buffer=nil, @virtual_path=nil>

Look at the return value assigned to @view_paths. It should not be an
array. It should be a PathSet object instance, which has an instance
variable called @paths, which holds an array of
OptimizedFileSystemResolver object instances, which themselves hold a
@path instance variable that is the very string represented in that
@view_paths array above. So what’s going on?

On 10 September 2012 02:41, John M. [email protected] wrote:

I’m going to invoke action view base from console, passing a string
object:

1.9.3p0 :016 > ActionView::Base.new(‘app/views’)

Look at the return value assigned to @view_paths. It should not be an
array. It should be a PathSet object instance

It is a PathSet object - the easiest way to check this is to type:
ActionView::Base.new(‘app/views’).view_paths.class

What you see when you call “ActionView::Base.new(‘app/views’)” is just
a string representation of the object. To assume when you look at the
to_s output in the console that the original object is what the to_s
produced is like looking at a black and white photograph and assuming
the subject of the photo was black and white.