Keep in mind, this is only during execution, you would need to store the
data externally (flat files, database, etc.) if you needed to know this
information across different executions.
foo.object_id.last_modified
NoMethodError: undefined method last_modified' for 10535580:Fixnum from (irb):18 from /usr/bin/irb:12:in’
ObjectSpace._id2ref(foo.object_id).last_modified
NoMethodError: undefined method last_modified' for [15, 15]:Array from (irb):19 from /usr/bin/irb:12:in’
ObjectSpace._id2ref(foo.object_id)
=> [15, 15]
Array.try_convert(foo)
=> [15, 15]
Array.try_convert(foo).last_modified
NoMethodError: undefined method last_modified' for [15, 15]:Array from (irb):22 from /usr/bin/irb:12:in’
Yeah! its good but not one I am looking for, may be what I am looking
for is not also possible.
no you are not, it was the other user that was looking for that, not
you, or is the the proof that you two are the same user?
the problem is that you dont understand the difference between an object
of a class and the class itself
in this case, last_modified was defined as class method, not as an
instance method so Array.last_modified works,but Array.new.last_modified
does NOT work oO
But one request to you,please don’t be off-topic. As there is no rule
that I can’t catch other users thread.
I wanted to laugh, but I just shook my head instead.
No, you can’t track the last_modified on a plain old ruby object. It
would have to be implemented at the language implementation level and I
don’t know of a single language that supports this.