Module: ObjectSpace

Defined in:
lib/rubyhacks.rb

Class Method Summary collapse

Class Method Details

.log_state(file, &block) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
# File 'lib/rubyhacks.rb', line 88

def self.log_state(file, &block)
	File.open(file, 'w') do |file|
		each_object do |obj|
			if block
				PP.pp(obj, file) if yield(obj)
			else
				PP.pp(obj, file)
			end
		end
	end
end