Class: SecID::CIK
Overview
CIK identifiers have no check digit and validation is based solely on format.
Central Index Key (CIK) - SEC identifier for entities filing with the SEC. A 1-10 digit number that uniquely identifies entities in SEC systems.
Constant Summary collapse
- FULL_NAME =
Human-readable name of the standard.
'Central Index Key'- ID_LENGTH =
Valid length(s) of a normalized identifier.
(1..10)
- EXAMPLE =
A representative valid identifier.
'0001521365'- VALID_CHARS_REGEX =
Pattern matching the identifier's permitted character set.
/\A[0-9]+\z/- ID_REGEX =
Regular expression for parsing CIK components.
/\A (?=\d{1,10}\z)(?<padding>0*)(?<identifier>[1-9]\d{0,9}) \z/x
Constants included from Generatable
Generatable::ALPHA, Generatable::ALPHANUMERIC, Generatable::DIGITS
Constants included from Validatable
Constants included from Normalizable
Instance Attribute Summary collapse
-
#padding ⇒ String?
readonly
The leading zeros in the CIK.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(cik) ⇒ CIK
constructor
A new instance of CIK.
- #normalize! ⇒ self
-
#normalized ⇒ String
The normalized 10-digit CIK.
- #to_s ⇒ String
Methods inherited from Base
#==, #as_json, example, full_name, has_check_digit?, #hash, id_length, length_specificity, length_values, short_name, #to_h
Methods included from Validatable
#errors, #valid?, #validate, #validate!
Methods included from Normalizable
Constructor Details
#initialize(cik) ⇒ CIK
Returns a new instance of CIK.
36 37 38 39 40 |
# File 'lib/sec_id/cik.rb', line 36 def initialize(cik) cik_parts = parse(cik) @padding = cik_parts[:padding] @identifier = cik_parts[:identifier] end |
Instance Attribute Details
#padding ⇒ String? (readonly)
Returns the leading zeros in the CIK.
33 34 35 |
# File 'lib/sec_id/cik.rb', line 33 def padding @padding end |
Instance Method Details
#normalize! ⇒ self
51 52 53 54 55 |
# File 'lib/sec_id/cik.rb', line 51 def normalize! super @padding = @full_id[0, self.class::ID_LENGTH.max - @identifier.length] self end |
#normalized ⇒ String
Returns the normalized 10-digit CIK.
44 45 46 47 |
# File 'lib/sec_id/cik.rb', line 44 def normalized validate! @identifier.rjust(self.class::ID_LENGTH.max, '0') end |
#to_s ⇒ String
58 59 60 |
# File 'lib/sec_id/cik.rb', line 58 def to_s full_id end |