Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A place for Ruby objects to hide instance variables

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 try
Octocat-spinner-32 CHANGES.txt
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 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.