Class: Forkforge::CodePoint

Inherits:
Object show all
Defined in:
lib/forkforge/internal/code_point.rb

Constant Summary collapse

UNICODE_FIELDS =
[
  :code_point,
  :character_name,
  :general_category,
  :canonical_combining_classes,
  :bidirectional_category,
  :character_decomposition_mapping,
  :decimal_digit_value,
  :digit_value,
  :numeric_value,
  :mirrored,
  :unicode_1_0_name,
  :_10646_comment_field,
  :uppercase_mapping,
  :lowercase_mapping,
  :titlecase_mapping
]

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ CodePoint

Returns a new instance of CodePoint.



28
29
30
31
32
33
34
# File 'lib/forkforge/internal/code_point.rb', line 28

def initialize hash
  UNICODE_FIELDS.each { |f|
    instance_eval %Q{
      @#{f} = hash[:#{f}]
    }
  }
end

Instance Method Details

#inspectObject



38
39
40
# File 'lib/forkforge/internal/code_point.rb', line 38

def inspect
  "'#{to_s}' ⇒ [#{@character_name}]"
end

#to_sObject



35
36
37
# File 'lib/forkforge/internal/code_point.rb', line 35

def to_s
  [@code_point.to_i(16)].pack('U')
end