Module: FreezeRay

Defined in:
lib/freeze_ray.rb

Instance Method Summary collapse

Instance Method Details

#attr_frozen(*attrs) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/freeze_ray.rb', line 2

def attr_frozen(*attrs)
  attrs.each do |attr|
    old_getter = instance_method(attr)
    define_method(attr) do
      old_getter.bind(self).call.freeze
    end
  end
end