Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission to the coding challenge #294

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

robotic-forest
Copy link

As my submission to this coding challenge, I wrote a FantasicParser class that can be used to extract the relevant images from both a file and from a URL. Just how fantastic it is, is of course a highly subjective value judgement.

Since using open-uri to directly download a page didn’t yield the same html structure as the provided file, I use selenium to fetch URLs to see if my parser works with different pages. I added this capability to the parser. As it is outside the scope of the exercise prompt, I also wrote the retrieved html to files, and 2 separate tests are provided, one with Selenium and one without. This way my parser can be evaluated without having to install firefox on the underlying system.

I’m curious as to feedback on the code structure, method naming conventions, etc. - these days I mostly write in the functional style (in Node), so this exercise also served as an re-exploration of how I would personally structure an object-oriented program in ruby.

Install with bundler install
To use the webdriver, make sure firefox is installed in the default system location
To get the desired JSON output, run ruby index.rb
To test just using files only: bundler exec rspec --color parser_files_only_spec.rb
To test using the webdriver: bundler exec rspec --color parser_webdriver_spec.rb

Happy holidays, y’all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant