Sha256: b9a70b705b66303a110284184912f99860b174dc13c14eb178efad5e7cb4150f

Contents?: true

Size: 519 Bytes

Versions: 36

Compression:

Stored size: 519 Bytes

Contents

#
# default values may be given either directly or as a block which will be
# evaluated in the context of self.  in both cases (value or block) the
# default is set only once and only if needed - it's a lazy evaluation.  the
# 'banger' method can be used to re-initialize a variable at any point whether
# or not it's already been initialized.
#
  require 'fattr'

  class C
    fattr :a => 42
    fattr(:b){ Float a }
  end

  c = C.new
  p c.a #=> 42
  p c.b #=> 42.0

  c.a = 43
  p c.a #=> 43
  c.a!
  p c.a #=> 42

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
fattr-2.4.0 samples/b.rb
fattr-2.3.0 samples/b.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/b.rb
fattr-2.2.2 samples/b.rb
abiquo-etk-0.6.4 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.6.3 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.6.2 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.6.1 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.6.0 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.5.9 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.5.8 vendor/fattr-2.1.0/samples/b.rb
fattr-2.2.1 samples/b.rb
abiquo-etk-0.5.3 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.4.42 vendor/fattr-2.1.0/samples/b.rb
fattr-2.2.0 samples/b.rb
abiquo-etk-0.4.33 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.4.32 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.4.29 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.4.25 vendor/fattr-2.1.0/samples/b.rb
abiquo-etk-0.4.24 vendor/fattr-2.1.0/samples/b.rb