Class: WhatsUp::FrozenSection

Inherits:
Object
  • Object
show all
Defined in:
lib/whats_up/frozen_section.rb

Overview

A classic designed to allow variables to be stored along with a frozen object.

Frozen objects can’t have new instance variables added directly, so this prevents whats_up methods from being locked out of inspecting anything frozen. This proxy class should be initialized automatically if whats_up detects that the object it’s to inspect is frozen.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, vars = {}) ⇒ FrozenSection

Creates a new FrozenSection object from the provided object and a list of instance variables to store



13
14
15
16
17
18
# File 'lib/whats_up/frozen_section.rb', line 13

def initialize(object, vars = {})
  @object = object
  vars.each do |key, value|
    instance_variable_set "@#{key}", value
  end
end

Instance Attribute Details

#objectObject (readonly)

The frozen object



9
10
11
# File 'lib/whats_up/frozen_section.rb', line 9

def object
  @object
end