Class: Pupa::Vote

Inherits:
Object
  • Object
show all
Includes:
Concerns::Sourceable, Concerns::Timestamps, Model
Defined in:
lib/pupa/models/vote.rb

Overview

A voter's vote in a vote event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Concerns::Sourceable

#add_source, #initialize, #sources=

Methods included from Model

#==, #[], #[]=, #_id=, #add_extra, append_features, #extras=, #fingerprint, #foreign_properties, #initialize, #to_h, #validate!

Instance Attribute Details

#group_idObject

Returns the value of attribute group_id.



11
12
13
# File 'lib/pupa/models/vote.rb', line 11

def group_id
  @group_id
end

#optionObject

Returns the value of attribute option.



11
12
13
# File 'lib/pupa/models/vote.rb', line 11

def option
  @option
end

#pair_idObject

Returns the value of attribute pair_id.



11
12
13
# File 'lib/pupa/models/vote.rb', line 11

def pair_id
  @pair_id
end

#roleObject

Returns the value of attribute role.



11
12
13
# File 'lib/pupa/models/vote.rb', line 11

def role
  @role
end

#vote_event_idObject

Returns the value of attribute vote_event_id.



11
12
13
# File 'lib/pupa/models/vote.rb', line 11

def vote_event_id
  @vote_event_id
end

#voter_idObject

Returns the value of attribute voter_id.



11
12
13
# File 'lib/pupa/models/vote.rb', line 11

def voter_id
  @voter_id
end

#weightObject

Returns the value of attribute weight.



11
12
13
# File 'lib/pupa/models/vote.rb', line 11

def weight
  @weight
end

Instance Method Details

#to_sString

Returns the vote's option, voter ID and vote event ID.

Returns:

  • (String)

    the vote's option, voter ID and vote event ID



19
20
21
# File 'lib/pupa/models/vote.rb', line 19

def to_s
  "#{option} by #{voter_id} in #{vote_event_id}"
end