Class: HomographicSpoofing::Detector::Rule::Context
- Inherits:
-
Object
- Object
- HomographicSpoofing::Detector::Rule::Context
- Defined in:
- lib/homographic_spoofing/detector/rule/context.rb
Direct Known Subclasses
Constant Summary collapse
- SCRIPT_COMMON =
"Common"
- SCRIPT_INHERITED =
"Inherited"
- IGNORED_SCRIPTS =
Set[SCRIPT_COMMON, SCRIPT_INHERITED]
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
-
#initialize(label:) ⇒ Context
constructor
A new instance of Context.
- #label_set ⇒ Object
- #scripts ⇒ Object
Constructor Details
#initialize(label:) ⇒ Context
Returns a new instance of Context.
4 5 6 |
# File 'lib/homographic_spoofing/detector/rule/context.rb', line 4 def initialize(label:) @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
2 3 4 |
# File 'lib/homographic_spoofing/detector/rule/context.rb', line 2 def label @label end |
Instance Method Details
#label_set ⇒ Object
16 17 18 |
# File 'lib/homographic_spoofing/detector/rule/context.rb', line 16 def label_set @label_set ||= label.chars.to_set end |
#scripts ⇒ Object
12 13 14 |
# File 'lib/homographic_spoofing/detector/rule/context.rb', line 12 def scripts @scripts ||= Unicode::Scripts.scripts(label).to_set - IGNORED_SCRIPTS end |