0.0
No commit activity in last 3 years
No release in over 3 years
A simple practice app demonstrating how to make a gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.10
 Project Readme

Seat Selector

A simple Ruby gem example.

Given a JSON input representing the available seats at a public venue, 'seat_selector' finds the best available seat(s) (meaning closest to front row, center-stage). If more than one seat is requested, 'seat_selector' finds the best available group of adjacent seats (within the same row).

Installation

To install:

$ gem install seat_selector

Usage

require 'seat_selector'

json_str = IO.read('path/to/data.json')

# Pass your JSON-formatted data to SeatSelector.
finder = SeatSelector.parse(json_str)

# request a single seat
seats = finder.get_best_seats(1)
# => [ <SeatSelector::Seat> ]

# request multiple seats
seats = finder.get_best_seats(3)

You'll get back an array of the best available group of adjacent seats, or an empty array if no such group is available. See ./spec/fixtures/valid_data.json for examples of the supported format.