Sha256: f453cf9601dfc275a4c9e09ec403f21756a6be0c697eb92791aa16f658d28737

Contents?: true

Size: 903 Bytes

Versions: 14

Compression:

Stored size: 903 Bytes

Contents

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

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
test_redmine_vz-0.0.24 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.23 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.22 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.21 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.20 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.19 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.18 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.17 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.16 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.14 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.13 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.12 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.11 lib/redmine_crm/helpers/vote_helper.rb
redmine_crm-0.0.10 lib/redmine_crm/helpers/vote_helper.rb