-
Create a class MyList that has an instance variable @list.
-
In MyList implement a method #each that yields successive members of @list and uses the MyEnumerable module.
-
Create a module MyEnumerable that implements the following methods: #all? #any? #filter
-
Each class and module should has a
-
Verify your solution:
irb> list = MyList.new(1, 2, 3, 4) => #<MyList: @list=[1, 2, 3, 4]>
irb> list.all? {|e| e < 5} => true irb> list.all? {|e| e > 5} => false
irb> list.any? {|e| e == 2} => true irb> list.any? {|e| e == 5} => false
irb> list.filter {|e| e.even?} => [2, 4]
This repository includes files with plain SQL that can be used to recreate a database:
-
Use Enumerable to view the Enumerable methods.
-
Use Class to view the #each method.
👤 Sylvestre
- GitHub: @pasytchangwa
- Twitter: @Sylvest10415595
- LinkedIn: LinkedIn
👤 Moses
- GitHub: @githubhandle
- LinkedIn: LinkedIn
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!