Module: SecID::Generatable
- Included in:
- Base
- Defined in:
- lib/sec_id/concerns/generatable.rb
Overview
Generated identifiers are valid in format only — they are not real, registered securities. Country codes, prefixes, dates, and attributes are random.
Provides generation of new, format-valid identifiers for use as test fixtures.
Including classes define a class-level generate_body(random) returning a valid
body (the identifier without its checksum). The default ClassMethods#generate
builds an instance from that body and restores the checksum for checksum types.
Types whose shape is not "body (+ checksum)" compose the full identifier in
generate_body (CFI, FISN) or override generate entirely (OCC).
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- ALPHA =
Uppercase letters A-Z.
('A'..'Z').to_a.freeze
- DIGITS =
Decimal digits 0-9.
('0'..'9').to_a.freeze
- ALPHANUMERIC =
Alphanumeric characters (digits then uppercase letters).
(DIGITS + ALPHA).freeze
Class Method Summary collapse
-
.included(base) ⇒ void
private
Extends the including identifier class with the concern's class methods.
Class Method Details
.included(base) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Extends the including identifier class with the concern's class methods.
36 37 38 |
# File 'lib/sec_id/concerns/generatable.rb', line 36 def self.included(base) base.extend(ClassMethods) end |