lib/make_voteable/exceptions.rb in make_voteable-0.0.2 vs lib/make_voteable/exceptions.rb in make_voteable-0.1.0
- old
+ new
@@ -2,32 +2,28 @@
module Exceptions
class AlreadyVotedError < StandardError
attr_reader :up_vote
def initialize(up_vote)
- @up_vote = up_vote
- end
-
- def message
- if @up_vote
- vote = "up voted"
+ vote = if up_vote
+ "up voted"
else
- vote = "down voted"
+ "down voted"
end
- "The voteable was already #{vote} by the voter."
+ super "The voteable was already #{vote} by the voter."
end
end
class NotVotedError < StandardError
- def message
- "The voteable was not voted by the voter."
+ def initialize
+ super "The voteable was not voted by the voter."
end
end
class InvalidVoteableError < StandardError
- def message
- "Invalid voteable."
+ def initialize
+ super "Invalid voteable."
end
end
end
end