Class: SecurityIdentifiers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/security_identifiers/base.rb

Direct Known Subclasses

CUSIP, ISIN, SEDOL

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#original_check_digitObject (readonly)

Returns the value of attribute original_check_digit.



8
9
10
# File 'lib/security_identifiers/base.rb', line 8

def original_check_digit
  @original_check_digit
end

Instance Method Details

#fix!Object



18
19
20
# File 'lib/security_identifiers/base.rb', line 18

def fix!
  @original_check_digit = check_digit
end

#to_sObject



14
15
16
# File 'lib/security_identifiers/base.rb', line 14

def to_s
  "#{@identifier}#{check_digit}"
end

#valid?Boolean



10
11
12
# File 'lib/security_identifiers/base.rb', line 10

def valid?
  @original_check_digit.to_i == check_digit
end