Class: OnyxCord::SearchedMessages

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/onyxcord/models/server.rb

Overview

A set of messages collected from a search query.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messagesArray<Message> (readonly)

Returns the messages that matched the search query.

Returns:

  • (Array<Message>)

    the messages that matched the search query.



1598
1599
1600
# File 'lib/onyxcord/models/server.rb', line 1598

def messages
  @messages
end

#total_resultsInteger (readonly)

Returns the total number of messages that matched the search query.

Returns:

  • (Integer)

    the total number of messages that matched the search query.



1601
1602
1603
# File 'lib/onyxcord/models/server.rb', line 1601

def total_results
  @total_results
end

Instance Method Details

#[](index) ⇒ Message

Get a single message that matched the search query by its index.

Parameters:

  • index (Integer)

    The index of the message to get from the array.

Returns:

  • (Message)

    the message that was found at the specified index.



1613
1614
1615
# File 'lib/onyxcord/models/server.rb', line 1613

def [](index)
  @messages[index]
end

#eachArray<Message>, Enumerable

Iterate over each message that matched the search query.

Returns:

  • (Array<Message>, Enumerable)

    The array that was iterated over.



1619
1620
1621
# File 'lib/onyxcord/models/server.rb', line 1619

def each(...)
  @messages.each(...)
end