Enumerable is a Ruby project that demonstrates a custom implementation of certain methods from the Enumerable module.
- Ruby
- Custom implementation of the
each
method for theMyList
class. - Custom implementations for
all?
,any?
, andfilter
methods in theMyEnumerable
module.
- Create an instance of the
MyList
class. - Utilize the custom methods from the
MyEnumerable
module to work with the list. - Test your code using the provided examples.
require_relative 'my_list'
# Create our list
list = MyList.new(1, 2, 3, 4)
# Test #all?
puts list.all? { |e| e < 5 } # Should output: true
puts list.all? { |e| e > 5 } # Should output: false
# Test #any?
puts list.any? { |e| e == 2 } # Should output: true
puts list.any? { |e| e == 5 } # Should output: false
# Test #filter
puts list.filter(&:even?).inspect # Should output: [2, 4]
👤 Clarence Atim
- GitHub: @ClarenceAtim
👤 RileyManda
- GitHub: @RileyManda
- Twitter: @rilecodez
- LinkedIn: rileymanda
- Add additional custom methods for MyEnumerable
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
If you like this project you can share this project to your friend
I would like to thank microverse for this project
This project is licensed under the MIT License.