Class: CertificateAuthority::SerialNumber
- Inherits:
-
Object
- Object
- CertificateAuthority::SerialNumber
- Includes:
- Revocable, Validations
- Defined in:
- lib/certificate_authority/serial_number.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
Returns the value of attribute number.
Attributes included from Revocable
Instance Method Summary collapse
-
#initialize ⇒ SerialNumber
constructor
A new instance of SerialNumber.
- #validate ⇒ Object
Methods included from Revocable
Methods included from Validations
Constructor Details
#initialize ⇒ SerialNumber
Returns a new instance of SerialNumber.
18 19 20 |
# File 'lib/certificate_authority/serial_number.rb', line 18 def initialize self.number = SecureRandom.random_number(2**128-1) end |
Instance Attribute Details
#number ⇒ Object
Returns the value of attribute number.
8 9 10 |
# File 'lib/certificate_authority/serial_number.rb', line 8 def number @number end |
Instance Method Details
#validate ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/certificate_authority/serial_number.rb', line 10 def validate if self.number.nil? errors.add :number, "must not be empty" elsif self.number.to_i <= 0 errors.add :number, "must be greater than zero" end end |