Module: TwitterCldr::Shared::UnicodeData

Defined in:
lib/twitter_cldr/shared/unicode_data.rb

Defined Under Namespace

Classes: Attributes

Class Method Summary collapse

Class Method Details

.for_code_point(code_point) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/twitter_cldr/shared/unicode_data.rb', line 12

def for_code_point(code_point)
  blocks = TwitterCldr.get_resource(:unicode_data, :blocks)

  #Find the target block
  target = blocks.find do |block_name, range|
    range.include? code_point.to_i(16)
  end

  if target
    block_data = TwitterCldr.get_resource(:unicode_data, target.first)
    code_point_data = block_data.fetch(code_point.to_sym) { |code_point_sym| get_range_start(code_point_sym, block_data) }
    Attributes.new(*code_point_data) if code_point_data
  end
end