Sha256: c8bfb8b0251f96b9dc820064ba3eb41502a629c9cb8da5c47b09c1eb9cf2ae51
Contents?: true
Size: 522 Bytes
Versions: 1
Compression:
Stored size: 522 Bytes
Contents
require "unicode_range/version" require "unicode_range/collection" class UnicodeRange def initialize(from:, to:) @from = from.to_i(16) @to = to.to_i(16) end def expand(except: []) Collection.new codepoints(except) end private attr_reader :from, :to def codepoints(except) [*from..to].select do |codepoint| not except.any? { |exclude| casecmp(to_hex(codepoint), exclude) } end end def to_hex(int) int.to_s(16) end def casecmp(x, y) x.casecmp(y) == 0 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unicode_range-1.0.0 | lib/unicode_range.rb |