Sha256: 6a374fc3981a3a2cb988c837713829bdeada1a9c9879608dc7382303683bd1f1

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module OpenCongress
  
  class VotingComparison < OpenCongressObject
    
    attr_accessor :total_votes, :same_vote, :percentage, :person1, :person2, :shared_committees, :hot_votes,
                  :other_votes
    
    def initialize(params)
      params.each do |key, value|
        instance_variable_set("@#{key}", value) if VotingComparison.instance_methods.include? key
      end
        
      set_people
      set_votes
            
    end    
    
    
    def set_people
      self.person1 = Person.new(self.person1["person"])
      self.person2 = Person.new(self.person2["person"])
    end
    
    def set_votes
      
      these_hot_votes = []
      hot_votes["vote"].each do |v|    
        nv = RollCallComparison.new(v)
        these_hot_votes << nv
      end
      
      self.hot_votes = these_hot_votes
      
      these_other_votes = []
      other_votes["vote"].each do |v|
        nv = RollCallComparison.new(v)
        these_other_votes << nv
      end
      
      self.other_votes = these_other_votes
      
    end
    
      
   
   
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opencongress-opencongress-ruby-0.0.4 lib/opencongress/voting_comparison.rb