Class: Dbl::Votes

Inherits:
Object
  • Object
show all
Defined in:
lib/topgg/votes.rb

Overview

This class Spreads the Vote response body into different methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Votes

Initializes the votes class



6
7
8
# File 'lib/topgg/votes.rb', line 6

def initialize(obj)
  @obj = obj
end

Instance Attribute Details

#objHash (readonly) Also known as: raw, data

Get raw hash return of the object



12
13
14
# File 'lib/topgg/votes.rb', line 12

def obj
  @obj
end

Instance Method Details

#firstSpreader::User

Get the first vote amongst all the other votes.



19
20
21
# File 'lib/topgg/votes.rb', line 19

def first
  Spreader::User.new(@obj[0])
end

#totalInteger

Get the total number of votes



25
26
27
# File 'lib/topgg/votes.rb', line 25

def total
  @obj.length
end