class Object

Add fully_freeze support to the object class.

Public Instance Methods

fully_freeze(progress={}) click to toggle source

Do fully_freeze the object.

# File lib/fully_freeze/object.rb, line 7
def fully_freeze(progress={})
  progress[object_id] = freeze

  instance_variables.each do |name|
    value = instance_variable_get(name)
    value.fully_freeze(progress) unless progress[value.object_id]
  end

  self
end
fully_frozen?(progress={}) click to toggle source

Is this object fully_frozen?

# File lib/fully_freeze/object.rb, line 19
def fully_frozen?(progress={})
  return false unless frozen?

  progress[object_id] = self

  instance_variables.each do |name|
    value = instance_variable_get(name)
    return false unless progress[value.object_id] || value.fully_frozen?(progress)
  end

  true
end