rubyproblems.com is a unique way to inprove your Ruby skills while still having fun. The challenges you'll find on this site are based on realistic scenarios you might encounter in day to day work.
Our problems alternate between full-scale scenarios and mini-sprints, with new material posted roughly every week.
Full scale problems have solutions available for purchase at $3 per article, but all mini-sprints have their solutions for free.
You've recently stumbled across a ton of useful geospatial data, but there is a catch: it is far from normalized. For this task, you'll need to take lat/long coordinates in a number of different formats and normalize them into standard Cartesian points in [x,y] form.
You'll be able to lean on Ruby's text processing strengths to make quick work of what seems to be a tedious project on the surface. If you can identify some patterns that are common between the data formats, you'll be able to handle this in a lot fewer steps than it might look like on a first glance. Use tests to build up a safety net, then refactor away until you end up with a solution you're happy with.
NOTE: This and all other mini-sprints allow you to download our solution for free, and the discussion thread is open to everyone.
Your best buddy, The Idea Guy has enlisted you to help out with his latest plan to make eleventy million dollars. Combining his love for Sudoku with his desire to foster synergy through web services, he has come up with a plan to make a distributed puzzle solving tool. He wants you to provide him with a proof of concept ASAP, so you'll need to take some shortcuts if you want to get things done on time.
This exercise will teach you about code auditing and re-use, as it encourages you to hunt down open source projects that will help you get your job done. To complete the task at hand, you'll also need to build a simple web service that provides a remote interface through which you can do some non-trivial data processing. Finally, you'll build a Ruby based client implementation so that you can get a feel for how your end users will interact with the service you built. If this all sounds like a lot of work, you probably aren't being nearly lazy enough. Read on to see where the shortcuts are
A travel agency has hired you to build a simple trip mileage calculator. They have a mileage and routing system in place already, and it's your job to integrate with it. But there's a catch: It only does point to point routing, and it is implemented as a web service that you won't have access to during development.
By working through this exercise, you'll sharpen your test-driven development skills. In particular, this problem will help you learn about practical uses of mock objects in testing, as well as mapping customer requirements to an automated test suite. The task at hand is meant to be easily approachable, but also represent realistic business requirements you might encounter in day to day Ruby work.