Sha256: 1af803a80b49fc16f2882eefaa83eea97d47c889b529f2bd5bcddf38e73e157e

Contents?: true

Size: 352 Bytes

Versions: 6

Compression:

Stored size: 352 Bytes

Contents

#
# basic usage is like attr, but note that attribute defines a suite of methods
#
  require 'attributes'

  class C
    attribute 'a'
  end

  c = C.new

  c.a = 42
  p c.a                 #=> 42
  p 'forty-two' if c.a? #=> 'forty-two'

#
# attributes works on object too 
#
  o = Object.new
  o.attribute 'answer' => 42
  p o.answer           #=> 42

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
attributes1-5.0.3 samples/a.rb
attributes1-5.0.2 samples/a.rb
attributes-4.0.0 samples/a.rb
attributes-4.1.0 samples/a.rb
attributes-5.0.0 samples/a.rb
attributes-5.0.1 samples/a.rb