Sunday, September 9, 2012

Re: [Rails] misleading variable value

On 10 September 2012 02:41, John Merlino <stoicism1@aol.com> 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.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate