Module: CharacterSet::RubyFallback::PlaneMethods

Included in:
CharacterSet::RubyFallback
Defined in:
lib/character_set/ruby_fallback/plane_methods.rb

Instance Method Summary collapse

Instance Method Details

#astral_partObject



8
9
10
# File 'lib/character_set/ruby_fallback/plane_methods.rb', line 8

def astral_part
  dup.keep_if { |cp| cp >= 0x10000 }
end

#bmp_partObject



4
5
6
# File 'lib/character_set/ruby_fallback/plane_methods.rb', line 4

def bmp_part
  dup.keep_if { |cp| cp < 0x10000 }
end

#member_in_plane?(num) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/character_set/ruby_fallback/plane_methods.rb', line 22

def member_in_plane?(num)
  ((num * 0x10000)...((num + 1) * 0x10000)).any? { |cp| include?(cp) }
end

#planesObject



12
13
14
15
16
17
18
19
20
# File 'lib/character_set/ruby_fallback/plane_methods.rb', line 12

def planes
  plane_set = {}
  plane_size = 0x10000.to_f
  each do |cp|
    plane = (cp / plane_size).floor
    plane_set[plane] = true
  end
  plane_set.keys
end