Skip to content

Commit

Permalink
Remove traces of the :key option
Browse files Browse the repository at this point in the history
Basing on code examples in the documentation and Attr Encrypted's
Readme, I believe that this option was intended to hold some encryption
key, possibly to be used with key derivation functions. Such feature
must be very useful in Attr Encrypted gem, but does not fit well in Attr
Masker.

Let's remove it completely.
  • Loading branch information
skalee authored and ronaldtse committed Jul 29, 2017
1 parent 56a9ee0 commit 2e8f586
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions lib/attr_masker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ def self.extended(base) # :nodoc:
# Options (any other options you specify are passed to the masker's mask
# methods)
#
# :key => The maskion key. This option may not be required if you're using a custom masker. If you pass
# a symbol representing an instance method then the :key option will be replaced with the result of the
# method before being passed to the masker. Objects that respond to :call are evaluated as well (including procs).
# Any other key types will be passed directly to the masker.
#
# :marshal => If set to true, attributes will be marshaled as well as masker. This is useful if you're planning
# on masking something other than a string. Defaults to false unless you're using it with ActiveRecord
# or DataMapper.
Expand Down Expand Up @@ -53,15 +48,15 @@ def self.extended(base) # :nodoc:
# class User
# # now all attributes will be encoded and marshaled by default
# attr_masker_options.merge!(:marshal => true, :some_other_option => true)
# attr_masker :configuration, :key => 'my secret key'
# attr_masker :configuration
# end
#
#
# Example
#
# class User
# attr_masker :email, :credit_card, :key => 'some secret key'
# attr_masker :configuration, :key => 'some other secret key', :marshal => true
# attr_masker :email, :credit_card
# attr_masker :configuration, :marshal => true
# end
#
# @user = User.new
Expand Down Expand Up @@ -147,10 +142,10 @@ def mask(attribute, value, options = {})
# Example
#
# class User
# attr_masker :email, :key => 'my secret key'
# attr_masker :email
# end
#
# User.masker_attributes # { :email => { :attribute => 'masker_email', :key => 'my secret key' } }
# User.masker_attributes # { :email => { :attribute => 'masker_email' } }
def masker_attributes
@masker_attributes ||= superclass.masker_attributes.dup
end
Expand All @@ -161,7 +156,7 @@ def masker_attributes
# Example
#
# class User
# attr_masker :email, :key => 'my secret key'
# attr_masker :email
# end
#
# User.mask_email('SOME_masker_EMAIL_STRING')
Expand Down Expand Up @@ -213,7 +208,7 @@ module InstanceMethods
#
# class User
# attr_accessor :secret_key
# attr_masker :email, :key => :secret_key
# attr_masker :email
#
# def initialize(secret_key)
# self.secret_key = secret_key
Expand Down

0 comments on commit 2e8f586

Please sign in to comment.