Sha256: 1890d2bbaa16518d5132f6dc6cbbdb471ef157334c687c95cc55c548ac8b3e0b

Contents?: true

Size: 968 Bytes

Versions: 37

Compression:

Stored size: 968 Bytes

Contents

module RedmineCrm
  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

37 entries across 37 versions & 1 rubygems

Version Path
redmine_crm-0.0.63 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.62 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.61 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.60 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.59 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.58 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.57 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.56 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.55 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.54 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.53 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.52 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.51 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.50 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.49 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.48 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.47 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.46 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.45 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.44 lib/redmine_crm/helpers/vote_helper.rb