TokenizeAttributes

TokenizeAttributes allows to define a tokenized attribute.

A before validation is generate on the attribute to set a tokenized value on the attribute

Configuration

TokenizeAttributes.configure do |config|
  config.tokenizer = proc { SecureRandom.hex }
end

Usage

Single attribute

class Object
  tokenized_attribute :authentication_token
end

Override tokenizer proc

class Object
    tokenized_attribute :attrb1, proc { SecureRandom.uuid }
end

Multiple attributes

class Object
    tokenized_attribute :authentication_token
end

Override tokenizer proc

class Object
    tokenized_attributes :attrb1, :attrb2, proc { SecureRandom.uuid }
end

Reset Attrb

object = Object.new
object.reset_tokenization_for_attrb

License

The gem is available as open source under the terms of the MIT License.