voteable_flo 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/lib/voteable_flo.rb +20 -0
 - metadata +43 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a0251c795249d6de19aee9675674cdeb5377fa32
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f6cc624ffe7442e6c970c84da1168b1bbe02990d
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e6a46384a6b0c5474fe0efdb9668539fee722125ec99d2000ed3596925bc4cc47b7507b1d5fe1d04bb967f2093037a60b106b805d064d6454473788204b59d3b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 81cc9165c9e3b684018a831a7c5d27461a4cbe15baf75711a1fb73a84d6307b7b3926ea6c5cc80d4d389d3950cd5de42beef21ce157a8796f8d5b34393cc3a27
         
     | 
    
        data/lib/voteable_flo.rb
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Using concerns
         
     | 
| 
      
 2 
     | 
    
         
            +
            module VoteableFlo
         
     | 
| 
      
 3 
     | 
    
         
            +
              extend ActiveSupport::Concern
         
     | 
| 
      
 4 
     | 
    
         
            +
              
         
     | 
| 
      
 5 
     | 
    
         
            +
              included do
         
     | 
| 
      
 6 
     | 
    
         
            +
                has_many :votes, as: :voteable
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              def total_votes
         
     | 
| 
      
 10 
     | 
    
         
            +
                self.up_votes - self.down_votes
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
              
         
     | 
| 
      
 13 
     | 
    
         
            +
              def up_votes
         
     | 
| 
      
 14 
     | 
    
         
            +
                self.votes.where(vote: true).size
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
              def down_votes
         
     | 
| 
      
 18 
     | 
    
         
            +
                self.votes.where(vote: false).size
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,43 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: voteable_flo
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Florence Liang
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-06-24 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 13 
     | 
    
         
            +
            description: A very simple voting gem
         
     | 
| 
      
 14 
     | 
    
         
            +
            email: flo.liang@my.com
         
     | 
| 
      
 15 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 16 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 17 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 18 
     | 
    
         
            +
            files:
         
     | 
| 
      
 19 
     | 
    
         
            +
            - lib/voteable_flo.rb
         
     | 
| 
      
 20 
     | 
    
         
            +
            homepage: http://github.com
         
     | 
| 
      
 21 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 22 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 23 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 24 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 25 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 26 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 27 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 28 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 29 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 30 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 31 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 32 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 33 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 34 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 35 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 36 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 37 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 38 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 39 
     | 
    
         
            +
            rubygems_version: 2.4.3
         
     | 
| 
      
 40 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 41 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 42 
     | 
    
         
            +
            summary: A voting gem
         
     | 
| 
      
 43 
     | 
    
         
            +
            test_files: []
         
     |