Kartik
Kartik

Reputation: 9853

Accessing Ruby Threads

Probably not even a valid question but how can I see what this block contains:

spec = Thread.current[:spec]
print spec # gives => #<RSpec::Core::ExampleGroup::Nested_1:0x7f61991d90c8>

Can I see any of the methods assigned to this or whatever is in it?

If more context is needed, I'm trying to understand what spec is doing here in function here but not being used anywhere (at least directly)

https://github.com/amfranz/rspec-hiera-puppet/blob/master/lib/rspec-hiera-puppet/puppet.rb#L7

Upvotes: 1

Views: 53

Answers (1)

BlackHatSamurai
BlackHatSamurai

Reputation: 23483

To view properties do:

spec.inspect

If you want to access those properties:

spec.propertyyouwant

Upvotes: 1

Related Questions