X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/936d687077455711e0c5031f0244cc873f225658..5a8b533b5abec8dc24674e4ef084b0b9779da8af:/app/models/raw_voter_list.rb diff --git a/app/models/raw_voter_list.rb b/app/models/raw_voter_list.rb new file mode 100644 index 0000000..2f7cb28 --- /dev/null +++ b/app/models/raw_voter_list.rb @@ -0,0 +1,22 @@ +class RawVoterList + + attr_accessor :email + attr_accessor :input_addresses + + include Enumerable + + def initialize(params={}) + @email = params[:email] || 1 + @input_addresses = params[:input_addresses] || String.new + end + + def email=(email) + @email = email + end + + def each + @input_addresses.split("\n").each do |address| + yield Voter.new( { :email => address } ) + end + end +end