-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Oh dear, Thunderbird butchered that.

[1] pry(main)> require 'objspace'
=> true
[2] pry(main)> class A
[2] pry(main)*   def foo
[2] pry(main)*     ObjectSpace::trace_object_allocations do
[2] pry(main)*       obj = Object.new
[2] pry(main)*       p "#{ObjectSpace::allocation_class_path(obj)}"
[2] pry(main)*     end
[2] pry(main)*   end
[2] pry(main)* end
=> :foo
[3] pry(main)>
[4] pry(main)> A.new.foo
""
=> ""



On 6/12/2014 12:51, Rylee Fowler wrote:
> Even when requiring 'objspace', I get an empty return statement.
> 
>> [1] pry(main)> require 'objspace' => true [2] pry(main)> class A
>>  [2] pry(main)*   def foo [2] pry(main)* 
>> ObjectSpace::trace_object_allocations do [2] pry(main)*       obj
>> = Object.new [2] pry(main)*       p 
>> "#{ObjectSpace::allocation_class_path(obj)}" [2] pry(main)* end
>> [2] pry(main)*   end [2] pry(main)* end => :foo [3] pry(main)> 
>> [4] pry(main)> A.new.foo "" => ""
> 
> 
> 
> On 6/12/2014 12:44, Jeremy Axelrod wrote:
>> Did you add require 'objspace'
> 
>> Sent from my phone
> 
>> On Jun 12, 2014, at 5:59 AM, Rajeev N B <rajeevrvis / gmail.com 
>> <mailto:rajeevrvis / gmail.com>> wrote:
> 
>>> 
>>> Using Ruby Version 2.1.2
>>> 
>>> |class A def foo ObjectSpace::trace_object_allocations do obj
>>> = Object.new p "#{ObjectSpace::allocation_class_path(obj)}" end
>>>  end end
>>> 
>>> A.new.foo #=> "Class"|
>>> 
>>> The above method is expected to return back the allocation
>>> class path of the object. But I am getting an empty string back
>>> instead of "Class". Is it an implementation bug in the method
>>> or the documentation is not updated.
>>> 
>>> Here is link 
>>> <http://www.ruby-doc.org/stdlib-2.1.1/libdoc/objspace/rdoc/ObjectSpace.html>
>>>
>>> 
for the standard library.
>>> 
>>> 
>>> -- Rajeev N Bharshetty Sent with Sparrow 
>>> <http://www.sparrowmailapp.com/?sig>
>>> 
> 
> 

- -- 
Rylee Fowler
rylee / rylee.me
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCgAGBQJTmdq/AAoJEAWmNCH2N+MzSfEH/1dJb0A1mc5Kh9jWPvijoQbe
anaa9HYrP/JupFoYO+fZAm/A6/FkEgkyBNWonwi1SLv8e9XCbhok0jm+FHDRFKkM
vwsiCBvmh/vASG9mGiOdN1pcUVkzb/etKKQG73xbYpjQH4tG9vS0THUJeJ3pXzq5
YE9pA2FKQcnLaIp/apXYG+Np3Jhod04W9A+j2VDwm08DKyo3I19UkkjFr17XA8H5
MJ4gIkagRIAR6PAV109xjyyVX6kf2zmzOK6tT5Ap18qVpSzQJ3fndpX9Pe6mJjJK
J8+plJpEOSGBHSXmlnEBu4zEbTUzspo5Vel6wemlR7UNzm/pWrpGP8vLHZdSoEI=
=+MO3
-----END PGP SIGNATURE-----