Class: Discordrb::Poll::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/poll.rb

Overview

Finalised results for a poll.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#message_idInteger (readonly)

Returns the ID of the message the poll result is for.

Returns:

  • (Integer)

    the ID of the message the poll result is for.



276
277
278
# File 'lib/discordrb/data/poll.rb', line 276

def message_id
  @message_id
end

#questionMedia (readonly)

Returns the display-data for the question of the poll.

Returns:

  • (Media)

    the display-data for the question of the poll.



273
274
275
# File 'lib/discordrb/data/poll.rb', line 273

def question
  @question
end

#total_votesInteger (readonly)

Returns the total amount of votes that the poll received.

Returns:

  • (Integer)

    the total amount of votes that the poll received.



279
280
281
# File 'lib/discordrb/data/poll.rb', line 279

def total_votes
  @total_votes
end

#winnerAnswer? (readonly) Also known as: answer

Returns the answer that won the poll, if any.

Returns:

  • (Answer, nil)

    the answer that won the poll, if any.



269
270
271
# File 'lib/discordrb/data/poll.rb', line 269

def winner
  @winner
end

Instance Method Details

#==(other) ⇒ true, false Also known as: eql?

Check if two result objects are equivalent.

Parameters:

  • other (Object)

    The object to compare the result object against.

Returns:

  • (true, false)

    Whether or not the result objects are equivalent.



314
315
316
# File 'lib/discordrb/data/poll.rb', line 314

def ==(other)
  other.is_a?(Result) ? @message_id == other.message_id : false
end