Class: Edoxen::VotingCounts

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/edoxen/voting_counts.rb,
sig/edoxen.rbs

Overview

VotingCounts — tally for a Voting instance.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#absentInteger? (readonly)

Returns the value of attribute absent.

Returns:

  • (Integer, nil)


216
217
218
# File 'sig/edoxen.rbs', line 216

def absent
  @absent
end

#abstentionsInteger? (readonly)

Returns the value of attribute abstentions.

Returns:

  • (Integer, nil)


215
216
217
# File 'sig/edoxen.rbs', line 215

def abstentions
  @abstentions
end

#ayesInteger? (readonly)

Returns the value of attribute ayes.

Returns:

  • (Integer, nil)


213
214
215
# File 'sig/edoxen.rbs', line 213

def ayes
  @ayes
end

#noesInteger? (readonly)

Returns the value of attribute noes.

Returns:

  • (Integer, nil)


214
215
216
# File 'sig/edoxen.rbs', line 214

def noes
  @noes
end

Instance Method Details

#marginInteger

Returns:

  • (Integer)


15
16
17
# File 'lib/edoxen/voting_counts.rb', line 15

def margin
  (ayes || 0) - (noes || 0)
end

#tied?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/edoxen/voting_counts.rb', line 19

def tied?
  ayes == noes
end

#totalInteger

Returns:

  • (Integer)


11
12
13
# File 'lib/edoxen/voting_counts.rb', line 11

def total
  (ayes || 0) + (noes || 0) + (abstentions || 0) + (absent || 0)
end