No commit activity in last 3 years
No release in over 3 years
A maskable attribute is an attribute that is made up of other attributes (masks), this ordering is set in the masked attribute and preserved across updates.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 2.3.10
 Project Readme

Maskable Attribute

maskable_attribute is an ActiveRecord extension that allows for 'masking' a records' attribute. It provides the ability to have an objects' attribute be dynamically assigned at a given point in time while providing the capability to make a one-location change that propagates through all resulting objects containing the resulting attribute mask.

Install

Via rubygems:

gem install maskable_attribute

Via bundler:

Add the following line to Gemfile:

gem 'maskable_attribute'

Then, run bundler:

bundle install

Usage

To use the maskable_attribute gem, simply create corresponding maskable_attribute attributes in the ActiveRecord model that you wish to affect.

For example, the following User class has a maskable attribute of :foo that can contain values of :bar, :baz and :qux

class User < ActiveRecord::Base
  maskable_attribute :foo, [ :bar, :baz ]
end

Creating a user with the above mask can be performed via the following:

user = User.new :bar => "a", :baz => "b", :foo => "{bar}-{baz}"

Now that the user object is created, there are several accessor methods to return different variations of the attribute:

user.masks              # { :foo => { :bar, :baz } }
user.foo.masks          # [ :bar, :baz ]
user.foo                # "a-b"
user.foo.unmasked       # "{bar}-{baz}"

Supported Ruby versions

Maskable Attribute supports Ruby 1.9.x+

Additional Information

Contributing

Contributions to the code-base are welcomed and handled via the normal Github pull request process.

Owner

maskable_attribute is written and maintained by Bill Transue