Sha256: 520ba9c79d2c330f7df6841e91758ad373df170feb32eb2b0ccf5f9b8be58d58

Contents?: true

Size: 331 Bytes

Versions: 3

Compression:

Stored size: 331 Bytes

Contents

$LOAD_PATH.unshift '../lib'
require 'memory_record'

class Foo
  include MemoryRecord
  memory_record [
    {key: :a},
  ]

  def a
    @var ||= 1
  end

  each do |e|
    e.a
    e.freeze
  end
end

v = Foo.first # => #<Foo:0x00007fdc05a532d0 @attributes={:key=>:a, :code=>0}, @var=1>
v.frozen?     # => true
v.a           # => 1

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
memory_record-0.0.11 examples/0270_instance_freeze.rb
memory_record-0.0.10 examples/0270_instance_freeze.rb
memory_record-0.0.9 examples/0270_instance_freeze.rb