Skip to content

Megagig/Ruby-Enumerable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Enumerable

The Enumerable module provides a set of methods that can be used with any collection-like object to work with its elements in an iterable and functional manner. The Enumerable provides collection classes with several traversal and searching methods, and with the ability to sort.

📗 Table of Contents

📖 About the project

It is Done with the goal to practice modules and classes with ruby. The Enumerable module provides a set of methods that can be used with any collection-like object to work with its elements in an iterable and functional manner. This means that any object that includes the Enumerable module gains access to the methods defined within it. Done as a collaborative project.

🛠 Built With

Tech Stack

html5

Key Features

  • A class MyList that has an instance variable @list. with a method #each that yields successive members of @list and uses the MyEnumerable module.
  • A Module MyEnumerable that implements the following methods (they should have the same funcionality as methods in Enumerable):
    • #all?
    • #any?
    • #filter
  • Each class and module should has a separate .rb file.

(back to top)

💻 Getting Started

To get a local copy up and running, follow these steps.

Prerequisites

In order to run this project you need: Install ruby. To install ruby in your machine you can follow the steps listed in the Ruby installation instructions guide

Setup

Clone this repository to your desired folder:

  cd my-enumerable
  git clone git@github.com:myaccount/my-project.git

Usage

To run the project, execute the following command:

  ruby my-enumerable.rb

Tests

# Create our list
irb> list = MyList.new(1, 2, 3, 4)
=> #<MyList: @list=[1, 2, 3, 4]>

# Test #all?
irb> list.all? {|e| e < 5}
=> true
irb> list.all? {|e| e > 5}
=> false

# Test #any?
irb> list.any? {|e| e == 2}
=> true
irb> list.any? {|e| e == 5}
=> false

# Test #filter
irb> list.filter {|e| e.even?}
=> [2, 4]

(back to top)

👥 Authors

👤 Obi Anthony

👤 Ayokunnumi Omololu

🔮 Future Features

  • Add more enumerable methods.
  • Create more test scenarios.

(back to top)

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

(back to top)

⭐️ Show your support

If you like this project give it a star 🌟🌟🌟

(back to top)

🙏 Acknowledgments

I would like to thank Microverse and Larissa Tao for using his template

(back to top)

📝 License

This project is MIT licensed.

(back to top)

About

The Enumerable module provides a set of methods that can be used with any collection-like object to work with its elements in an iterable and functional manner.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages