Class: SecID::Suggestion
- Inherits:
-
Data
- Object
- Data
- SecID::Suggestion
- Defined in:
- lib/sec_id/suggestion.rb,
lib/sec_id/suggestion.rb
Overview
Reopened to add the domain enumerations and serialization helpers per the repo convention (see Base#as_json).
Constant Summary collapse
- EDIT_KINDS =
The edit kinds
editcan take, in rank order (see SecID::Suggestable::RANK). %i[substitution transposition checksum].freeze
- CONFIDENCE_LEVELS =
The non-nil confidence tiers
confidencecan take;:checksumcandidates carrynil. %i[high medium].freeze
Instance Attribute Summary collapse
-
#confidence ⇒ Symbol?
readonly
:high (homoglyph), :medium (transposition), or nil (:checksum).
-
#edit ⇒ Symbol
readonly
:substitution, :transposition, or :checksum.
-
#from ⇒ String
readonly
The original character(s).
-
#identifier ⇒ SecID::Base
readonly
The valid, parsed corrected identifier.
-
#position ⇒ Integer?
readonly
The edit position (nil for :checksum).
-
#to ⇒ String
readonly
The replacement character(s).
-
#type ⇒ Symbol
readonly
The identifier type key (e.g. :isin).
Instance Method Summary collapse
-
#as_json ⇒ Hash
The symbol-keyed field hash (JSON-compatible).
-
#to_s ⇒ String
The corrected identifier string.
Instance Attribute Details
#confidence ⇒ Symbol? (readonly)
Returns :high (homoglyph), :medium (transposition), or nil (:checksum).
38 |
# File 'lib/sec_id/suggestion.rb', line 38 Suggestion = Data.define(:type, :identifier, :edit, :position, :from, :to, :confidence) |
#edit ⇒ Symbol (readonly)
Returns :substitution, :transposition, or :checksum.
38 |
# File 'lib/sec_id/suggestion.rb', line 38 Suggestion = Data.define(:type, :identifier, :edit, :position, :from, :to, :confidence) |
#from ⇒ String (readonly)
Returns the original character(s).
38 |
# File 'lib/sec_id/suggestion.rb', line 38 Suggestion = Data.define(:type, :identifier, :edit, :position, :from, :to, :confidence) |
#identifier ⇒ SecID::Base (readonly)
Returns the valid, parsed corrected identifier.
38 |
# File 'lib/sec_id/suggestion.rb', line 38 Suggestion = Data.define(:type, :identifier, :edit, :position, :from, :to, :confidence) |
#position ⇒ Integer? (readonly)
Returns the edit position (nil for :checksum).
38 |
# File 'lib/sec_id/suggestion.rb', line 38 Suggestion = Data.define(:type, :identifier, :edit, :position, :from, :to, :confidence) |
#to ⇒ String (readonly)
Returns the replacement character(s).
38 |
# File 'lib/sec_id/suggestion.rb', line 38 Suggestion = Data.define(:type, :identifier, :edit, :position, :from, :to, :confidence) |
#type ⇒ Symbol (readonly)
Returns the identifier type key (e.g. :isin).
38 |
# File 'lib/sec_id/suggestion.rb', line 38 Suggestion = Data.define(:type, :identifier, :edit, :position, :from, :to, :confidence) |
Instance Method Details
#as_json ⇒ Hash
Returns the symbol-keyed field hash (JSON-compatible).
50 51 52 |
# File 'lib/sec_id/suggestion.rb', line 50 def as_json(*) to_h end |
#to_s ⇒ String
Returns the corrected identifier string.
55 56 57 |
# File 'lib/sec_id/suggestion.rb', line 55 def to_s identifier.to_s end |