/usr/lib/ruby/vendor_ruby/ice_nine/freezer/object.rb is in ruby-ice-nine 0.11.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # encoding: utf-8
module IceNine
class Freezer
# A freezer class for handling Object instances
class Object < self
# Deep Freeze an object
#
# @example
# object = IceNine.deep_freeze(Object.new)
#
# @param [Object] object
# @param [RecursionGuard] recursion_guard
#
# @return [Object]
def self.guarded_deep_freeze(object, recursion_guard)
return object unless object.respond_to?(:freeze)
object.freeze
freeze_instance_variables(object, recursion_guard)
object
end
# Handle freezing the object's instance variables
#
# @param [Object] object
# @param [RecursionGuard] recursion_guard
#
# @return [undefined]
#
# @api private
def self.freeze_instance_variables(object, recursion_guard)
object.instance_variables.each do |ivar_name|
Freezer.guarded_deep_freeze(
object.instance_variable_get(ivar_name),
recursion_guard
)
end
end
private_class_method :freeze_instance_variables
end # Object
BasicObject = Object
end # Freezer
end # IceNine
|