Skip to content
A place for Ruby objects to hide instance variables
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
try
CHANGES.txt
LICENSE.txt
README.rdoc
Rakefile
attic.gemspec

README.rdoc

Attic - v0.5

A place to hide private instance variables in your Ruby objects.

Example

require 'attic'

class String
  extend Attic
  attic :timestamp
end

a = "anything"
a.timestamp = "1980-11-18"
a.instance_variables                      # => []
a.timestamp                               # 1980-11-18

a.attic_variables                         # => [:timestamp]

a.attic_variable_set :tags, [:a, :b, :c]
a.attic_variable_get :tags                # [:a, :b, :c]

a.attic_variables                         # => [:timestamp, :tags]

Some objects have no metaclasses

Symbol and Fixnum objects do not have metaclasses so instance variables are hidden in the object itself.

Installation

Via Rubygems, one of:

$ gem install attic

or via download:

Credits

  • Delano (@solutious.com)

License

See: LICENSE.txt

Something went wrong with that request. Please try again.