Sha256: b24311f1ffcc0b7a04f94b73cf06cf868d5e560d7830854b92943c0474291f3b

Contents?: true

Size: 342 Bytes

Versions: 4

Compression:

Stored size: 342 Bytes

Contents

#
# of course fattrs works as well at class/module level as at instance
# level
#
  require 'fattr'

  module Logging 
    Level_names = {
      0 => 'INFO',
      # ...
      42 => 'DEBUG',
    }

    class << self
      fattr 'level' => 42
      fattr('level_name'){ Level_names[level] }
    end
  end

p Logging.level
p Logging.level_name

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fattr-1.1.0 samples/f.rb
fattr-1.0.2 samples/f.rb
fattr-1.0.1 samples/f.rb
fattr-1.0.3 samples/f.rb