Sha256: daf133ed5a7e022dc73f0266fde5ecd535c47d9b7a8fdca86eddb86f11db5dbc
Contents?: true
Size: 593 Bytes
Versions: 1
Compression:
Stored size: 593 Bytes
Contents
module RubyQuiz2 class PeopleList include Enumerable def initialize(list=nil) import list if list end def people @people ||= [] end def length people.length end def each people.each { |person| yield person } end private def import(list) list.split("\n").each do |line| first_name, family_name, email = line.split(" ") name = [first_name, family_name].join(" ") email = email.gsub(/[<>]/, "") people << Person.new("#{first_name} #{family_name}", email) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_quiz_2-1.0.0 | lib/ruby_quiz_2/people_list.rb |