Class: ATSPI::Accessible::Text::Character

Inherits:
Object
  • Object
show all
Defined in:
lib/atspi/accessible/text/character.rb

Overview

Represents a single character in a ATSPI::Accessible::Text.

Attributes collapse

Representations collapse

Instance Method Details

#extents(relative_to:) ⇒ Extents

Returns its extents.

Parameters:

  • relative_to (Symbol)

    coordinate system derived from libatspi’s AtspiCoordType enum by removing the prefix ATSPI_COORD_TYPE and making it lowercase

Returns:

See Also:



24
25
26
# File 'lib/atspi/accessible/text/character.rb', line 24

def extents(relative_to:)
  Extents.new(@native.character_extents(@offset, relative_to))
end

#inspectString

Returns itself as an inspectable string.

Returns:

  • (String)

    itself as an inspectable string



38
39
40
41
# File 'lib/atspi/accessible/text/character.rb', line 38

def inspect
  "#<#{self.class.name}:0x#{'%x14' % __id__} @to_s=#{to_s.inspect} @length=#{length} " <<
    "@offset=#{@offset} @extents=#{extents(relative_to: :screen).inspect}>"
end

#length1

Returns its length.

Returns:

  • (1)

    its length



13
14
15
# File 'lib/atspi/accessible/text/character.rb', line 13

def length
  1
end

#to_sString

Returns its string representation.

Returns:

  • (String)

    its string representation

See Also:



33
34
35
# File 'lib/atspi/accessible/text/character.rb', line 33

def to_s
  [@native.character_at_offset(@offset)].pack("U") # UCS-4 codepoint to readable character
end