Class: RubyQuiz2::PeopleList
- Inherits:
-
Object
- Object
- RubyQuiz2::PeopleList
- Includes:
- Enumerable
- Defined in:
- lib/ruby_quiz_2/people_list.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(list = nil) ⇒ PeopleList
constructor
A new instance of PeopleList.
- #length ⇒ Object
- #people ⇒ Object
Constructor Details
#initialize(list = nil) ⇒ PeopleList
Returns a new instance of PeopleList.
5 6 7 |
# File 'lib/ruby_quiz_2/people_list.rb', line 5 def initialize(list=nil) import list if list end |
Instance Method Details
#each ⇒ Object
17 18 19 |
# File 'lib/ruby_quiz_2/people_list.rb', line 17 def each people.each { |person| yield person } end |
#length ⇒ Object
13 14 15 |
# File 'lib/ruby_quiz_2/people_list.rb', line 13 def length people.length end |
#people ⇒ Object
9 10 11 |
# File 'lib/ruby_quiz_2/people_list.rb', line 9 def people @people ||= [] end |