This project is a study implementation of monads in Ruby, focusing on the Maybe and Result monads. It is designed to help understand the concepts of monads, functional programming, and how they can be applied in Ruby.
The project currently includes:
- Maybe Monad: Represents optional values (
SomeandNone). - Result Monad: Represents computations that can succeed (
Ok) or fail (Err).
More monads may be added in the future as the project evolves.
- Docker and Docker Compose installed on your machine.
Clone the repository to your local machine:
git clone https://github.com/Paulo-Rodrigues/ruby-monads.git
cd ruby-monads
This project uses Docker to provide a consistent development environment. To build and run the project, follow these steps:
-
Build the Docker image:
docker-compose build
-
Run the container and start a Bash session:
docker-compose run --rm ruby-monads bash
This will drop you into a Bash shell inside the container, where you can execute Ruby commands.
This project uses RSpec for testing. To run the tests, execute the following command inside the Docker container:
bundle exec rspec
This will run all the test files in the spec directory and display the results.