Sha256: 0785b641889ab073931bcfae32a28c5e44202cf6c41fcf215e310696b5310fd4
Contents?: true
Size: 967 Bytes
Versions: 8
Compression:
Stored size: 967 Bytes
Contents
module Redmineup module ActsAsVotable module Helpers # this helper provides methods that help find what words are # up votes and what words are down votes # # It can be called # # votable_object.votable_words.that_mean_true # module Words def votable_words VotableWords end end class VotableWords def self.that_mean_true ['up', 'upvote', 'like', 'liked', 'positive', 'yes', 'good', 'true', 1, true] end def self.that_mean_false ['down', 'downvote', 'dislike', 'disliked', 'negative', 'no', 'bad', 'false', 0, false] end # check is word is a true or bad vote # if the word is unknown, then it counts it as a true/good # vote. this exists to allow all voting to be good by default def self.meaning_of(word) !that_mean_false.include?(word) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems