Class: HomographicSpoofing::Detector::Rule::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/homographic_spoofing/detector/rule/context.rb

Direct Known Subclasses

Idn::Context

Constant Summary collapse

SCRIPT_COMMON =
"Common"
SCRIPT_INHERITED =
"Inherited"
IGNORED_SCRIPTS =
Set[SCRIPT_COMMON, SCRIPT_INHERITED]

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#labelObject (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_setObject



16
17
18
# File 'lib/homographic_spoofing/detector/rule/context.rb', line 16

def label_set
  @label_set ||= label.chars.to_set
end

#scriptsObject



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