Skip to content

Search for all Ruby classes, ruby modules, and also for a specific class/module of your needs in Scraper for Ruby-docs 2.7.1. Built with Ruby.

Notifications You must be signed in to change notification settings

Victorgonbu/Ruby-docs-web-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby-Docs Web Scraper

Hello ladies and gentlemen, This is the Microverse Ruby capstone project.

For this project, I created a scraper for Ruby-docs 2.7.1. In which you can see all Ruby classes, all ruby modules, and also search for a specific class/module of your needs.
Choose whether you want to display all class methods or all instance methods, no matter what your selection is, the scraper will provide you with a method list and a class/module URL.

How it works

First of all, the menu will be displayed:

image

Here you can input an option number, input 1 if you want to see all classes, 2 if you want to see all modules, or 3 if you just want to get out of the program.

After inputting the desired option, you will see something like this (in this case I choose to see all modules):

image

As you can see all Ruby modules are displayed. additionally, there is a way you can search for a specific class/module. So I will try to search for the IO module to see what happens.

image

oh! it seems that there is no exact match for IO, however, ruby-docs-scraper will drop a list of related results for your search and then ask you again for a specific module/class.

knowing that i'll input Math in the search field to see what happens next

image

Ruby-docs-scraper will display another menu asking you for an input number depending on what you want to see, so you can either see all class methods or all instance methods. But if there are no methods for module/class searched, then it will drop the following message (fatal class in this case):

image

As we all know there are no instance methods for the Math module. So This is what happens if I try to display instance methods for the Math module:

image

It will tell you that there are no instance methods Math module and also will provide you with a class/module URL.

However, Math has a bunch of class methods, so this is what happens if I try to display them:

image

As expected, it will drop a list with all class methods together with the Math module URL.

Environment set up requirements

To run this scraper, you need ruby installed in your environment. Run the following command:

$ ruby -v

You should have a result similar to this:

ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

If you don't get that result, follow this link and install Ruby in your local environment.

Getting Started

To get a local copy up and running follow these simple example steps

  • fork the repository and create a local one on your computer
  • move to the repository inside the command line using cd and the path to the file
  • run bundle install
  • to run the file enter bin/main.rb from inside the main folder in the repository
  • use the Ruby-docs-scraper

Running the RSpec tests

RSpec testing tool is being used to test all enumerable methods. Detailed documentation about this tool can be found here

Install

  • In a terminal window type gem install rspec

Run

For this project we have alredy created 2 files called methods_spec.rb and url_spec.rb. If you want to create another one, make sure you follow name required convetion: [your file name] _spec.rb. same way we created the 2 existing ones.

  • Open ./spec/methods_spec.rb and ./spec/url_spec.rb file
  • Open a terminal window and type rspec
  • If all test were passed you will see:

image

Else you'll see a red message.

Built With

  • Ruby
  • Nokogiri gem
  • Rspec

Live Demo

Run on Repl.it

Author

👤 Victor Manuel Gonzalez Buitrago

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

📝 License

This project is MIT licensed.

About

Search for all Ruby classes, ruby modules, and also for a specific class/module of your needs in Scraper for Ruby-docs 2.7.1. Built with Ruby.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages