Sha256: e36c92b0cba6b6d70f0348c63150fe6f1cb222b85fb6b5cc966311415b18ce2b

Contents?: true

Size: 567 Bytes

Versions: 10

Compression:

Stored size: 567 Bytes

Contents

class CharacterSet
  module RubyFallback
    module PlaneMethods
      def bmp_part
        dup.keep_if { |cp| cp < 0x10000 }
      end

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

      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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
character_set-1.2.0-java lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.2.0 lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.1.2-java lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.1.2 lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.1.1-java lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.1.1 lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.1.0-java lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.1.0 lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.0.0-java lib/character_set/ruby_fallback/plane_methods.rb
character_set-1.0.0 lib/character_set/ruby_fallback/plane_methods.rb