Class: UnicodeScriptDetector::ScriptGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/unicode_script_detector/script_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(script, chars, name) ⇒ ScriptGroup

Returns a new instance of ScriptGroup.



5
6
7
8
9
10
# File 'lib/unicode_script_detector/script_group.rb', line 5

def initialize(script, chars, name)
  @script = script
  @chars = chars
  @text = chars.join
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/unicode_script_detector/script_group.rb', line 3

def name
  @name
end

#scriptObject (readonly)

Returns the value of attribute script.



3
4
5
# File 'lib/unicode_script_detector/script_group.rb', line 3

def script
  @script
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/unicode_script_detector/script_group.rb', line 3

def text
  @text
end

Instance Method Details

#charactersObject



16
17
18
# File 'lib/unicode_script_detector/script_group.rb', line 16

def characters
  @characters ||= @chars.map { |char| Character.new(char, @script, @name) }
end

#lengthObject



12
13
14
# File 'lib/unicode_script_detector/script_group.rb', line 12

def length
  @chars.length
end