Sha256: 09d084e1faf96077a8c793a96e7c6d05fccd82f63b0a55bfb82f96b92b2b0577

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

module Pupa
  # A voter's vote in a vote event.
  class Vote
    include Model

    self.schema = File.expand_path(File.join('..', '..', '..', 'schemas', 'popolo', 'vote.json'), __dir__)

    include Concerns::Timestamps
    include Concerns::Sourceable

    attr_accessor :vote_event_id, :voter_id, :option, :group_id, :role, :weight, :pair_id
    dump          :vote_event_id, :voter_id, :option, :group_id, :role, :weight, :pair_id

    foreign_key :vote_event_id, :voter_id, :group_id, :pair_id

    # Returns the vote's option, voter ID and vote event ID.
    #
    # @return [String] the vote's option, voter ID and vote event ID
    def to_s
      "#{option} by #{voter_id} in #{vote_event_id}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pupa-0.2.4 lib/pupa/models/vote.rb