Class: Ucode::Unicode::Block

Inherits:
Struct
  • Object
show all
Defined in:
lib/ucode/unicode/block.rb

Overview

A Unicode block — a contiguous range of codepoints with a name. There are ~346 blocks in Unicode 17.0.0.

Pure value object like Plane. The id field uses the underscore form (e.g., "Basic_Latin") for filesystem/JSON key compatibility; the name field preserves the original Unicode spelling.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#first_cpObject

Returns the value of attribute first_cp

Returns:

  • (Object)

    the current value of first_cp



11
12
13
# File 'lib/ucode/unicode/block.rb', line 11

def first_cp
  @first_cp
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



11
12
13
# File 'lib/ucode/unicode/block.rb', line 11

def id
  @id
end

#last_cpObject

Returns the value of attribute last_cp

Returns:

  • (Object)

    the current value of last_cp



11
12
13
# File 'lib/ucode/unicode/block.rb', line 11

def last_cp
  @last_cp
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



11
12
13
# File 'lib/ucode/unicode/block.rb', line 11

def name
  @name
end

#plane_numberObject

Returns the value of attribute plane_number

Returns:

  • (Object)

    the current value of plane_number



11
12
13
# File 'lib/ucode/unicode/block.rb', line 11

def plane_number
  @plane_number
end

Instance Method Details

#cover?(codepoint) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ucode/unicode/block.rb', line 23

def cover?(codepoint)
  range.cover?(codepoint)
end

#rangeObject



19
20
21
# File 'lib/ucode/unicode/block.rb', line 19

def range
  (first_cp..last_cp)
end