Sha256: 9ee508e08240889944552f7ea531097876b9b495630275f6338a63f1f19d83a4

Contents?: true

Size: 587 Bytes

Versions: 2

Compression:

Stored size: 587 Bytes

Contents

module MakeVoteable
  module Exceptions
    class AlreadyVotedError < StandardError
      attr_reader :up_vote

      def initialize(up_vote)
        vote = if up_vote
          "up voted"
        else
          "down voted"
        end

        super "The voteable was already #{vote} by the voter."
      end
    end

    class NotVotedError < StandardError
      def initialize
        super "The voteable was not voted by the voter."
      end
    end

    class InvalidVoteableError < StandardError
      def initialize
        super "Invalid voteable."
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
make_voteable-0.1.1 lib/make_voteable/exceptions.rb
make_voteable-0.1.0 lib/make_voteable/exceptions.rb