Module: ATSPI::SelectableCollection

Includes:
Collection
Included in:
Accessible::Children, Accessible::Table::Columns, Accessible::Table::Rows
Defined in:
lib/atspi/selectable_collection.rb

Overview

Included in classes representing a collection having selectable items

Defined Under Namespace

Modules: Selected

Selection collapse

Representation collapse

Enumerable interface collapse

Instance Method Details

#[](idx) ⇒ Object Originally defined in module Collection

alias for #at

#at(idx) ⇒ Object Originally defined in module Collection

Returns item at index idx.

Parameters:

  • idx (Integer)

Returns:

  • (Object)

    item at index idx

#count0 Originally defined in module Collection

Returns default size of collection.

Returns:

  • (0)

    default size of collection

#deselect_alltrue, false

Deselects all items

Returns:

  • (true, false)

    indicating success



20
21
22
# File 'lib/atspi/selectable_collection.rb', line 20

def deselect_all
  selected.map(&:deselect).all?
end

#eachObject Originally defined in module Collection

prerequisite for Enumerable

#inspectString

Returns instance as inspectable string.

Returns:

  • (String)

    instance as inspectable string



27
28
29
# File 'lib/atspi/selectable_collection.rb', line 27

def inspect
  "#<#{self.class.name}:0x#{'%x14' % __id__} @count=#{count} @selected=#{selected.inspect}>"
end

#last(n = 1) ⇒ Object+ Originally defined in module Collection

Returns item(s) from the end.

Parameters:

  • n (Integer) (defaults to: 1)

    number of items to return

Returns:

  • (Object, Array<Object>)

    item(s) from the end

#lengthObject Originally defined in module Collection

alias for #count

#select_alltrue, false

Selects all items

Returns:

  • (true, false)

    indicating success



14
15
16
# File 'lib/atspi/selectable_collection.rb', line 14

def select_all
  map(&:select).all?
end

#selectedSelected

Returns its selected subset.

Returns:



8
9
10
# File 'lib/atspi/selectable_collection.rb', line 8

def selected
  self.class::Selected.new(@native)
end

#sizeObject Originally defined in module Collection

alias for #count