class FecResults::Result

Attributes

candidate_first[R]
candidate_last[R]
candidate_name[R]
chamber[R]
date[R]
district[R]
fec_id[R]
general_combined_party_pct[R]
general_combined_party_votes[R]
general_pct[R]
general_runoff_pct[R]
general_runoff_votes[R]
general_unopposed[R]
general_votes[R]
general_winner[R]
incumbent[R]
notes[R]
party[R]
primary_pct[R]
primary_unopposed[R]
primary_votes[R]
runoff_pct[R]
runoff_votes[R]
state[R]
year[R]

Public Class Methods

create_from_results(results) click to toggle source
# File lib/fec_results/result.rb, line 18
def self.create_from_results(results)
  results.map{|r|  
  self.new :year => r[:year],
           :date => r[:date],
           :chamber => r[:chamber], 
           state: r[:state], 
           :district => r[:district], 
           :fec_id => r[:fec_id], 
           :incumbent => r[:incumbent], 
           :candidate_last => r[:candidate_last], 
           :candidate_first => r[:candidate_first],
           :candidate_suffix => r[:candidate_suffix],
           :candidate_name => r[:candidate_name], 
           party: r[:party],
           :primary_votes => r[:primary_votes], 
           :primary_pct => r[:primary_pct],
           :primary_unopposed => r[:primary_unopposed],
           :runoff_votes => r[:runoff_votes], 
           :runoff_pct => r[:runoff_pct], 
           :general_votes => r[:general_votes], 
           :general_pct => r[:general_pct],
           :general_unopposed => r[:general_unopposed],
           :general_runoff_votes => r[:general_runoff_votes], 
           :general_runoff_pct => r[:general_runoff_pct],
           :general_combined_party_votes => r[:general_combined_party_votes], 
           :general_combined_party_pct => r[:general_combined_party_pct], 
           :general_winner => r[:general_winner], 
           :notes => r[:notes]}
end
new(params={}) click to toggle source
# File lib/fec_results/result.rb, line 8
def initialize(params={})
  params.each_pair do |k,v|
   instance_variable_set("@#{k}", v)
  end
end

Public Instance Methods

to_s() click to toggle source
# File lib/fec_results/result.rb, line 14
def to_s
  "#<FecResults::Result:#{year.to_s}:#{chamber}:#{state}:#{district.to_i}>"
end