Module: ATSPI::SelectableCollection::Selected

Overview

Included in classes representing the selected subset of a selectable collection

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

#eachObject Originally defined in module Collection

prerequisite for Enumerable

#inspectString

Returns instance as inspectable string.

Returns:

  • (String)

    instance as inspectable string



16
17
18
19
20
# File 'lib/atspi/selectable_collection/selected.rb', line 16

def inspect
  indices = self.indices(limit: 5).inspect
  indices[-1] = ", …]" if count > 5
  "#<#{self.class.name}:0x#{'%x14' % __id__} @count=#{count} @indices=#{indices}>"
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

#sizeObject Originally defined in module Collection

alias for #count