Module: MaskedIdentifier
- Defined in:
- lib/code-generator.rb,
lib/masked-identifier.rb
Overview
Generates a unique code based on a property of an ActiveRecord object
Usage: code = CodeGenerator.unique_code(klass, property, options = {})
Required parameters: klass = the ActiveRecord object property = the name of the property to check for uniqueness
Optional (options hash): length: number of characters to include in code (default = 10) charset: character set to use when generating codes (default = a-zA-Z0-9) attempts: number of attempts to find a unique code (default = 20)
Possible Errors: CodeGenerator::TooManyFailedAttempts if unable to find a unique code CodeGenerator::InvalidAttemptsValue if value provided is not an Integer or < 1 CodeGenerator::InvalidCodeLength if value provided is not an Integer or < 1 CodeGenerator::InvalidCharset if value provided is not an Array with size >= 1
Defined Under Namespace
Modules: ClassMethods, InstanceMethods Classes: CodeGenerator
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
28 29 30 |
# File 'lib/masked-identifier.rb', line 28 def self.included(base) base.send :extend, ClassMethods end |