0.0
No commit activity in last 3 years
No release in over 3 years
Finds any combination of dishes that add up exactly to the target price.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.8
~> 10.0
 Project Readme

SearchMenu

Searches a menu and finds any items that will add up to a specific price.

Installation

Add this line to your application's Gemfile:

gem 'search_menu'

And then execute:

$ bundle

Or install it yourself as:

$ gem install search_menu

Usage

There are several ways of using SearchMenu. The first way is to go through the SearchMenu class itself.

require 'SearchMenu'

search = SearchMenu.new
search.get_file_or_data(file_name)

The second way is to modify the String or Array classes by including either core extension.

require 'search_menu/core_ext/array'   # extends only Array
require 'search_menu/core_ext/hash'  # extends only Hash
require 'search_menu/core_ext'         # extends both Array/Hash

[["$10.00"], ["mixed fruit", "$2.15"], ["french fries", "$2.75"], ["side salad", "$3.35"], ["hot wings",
"$3.55"], ["mozzarella sticks", "$4.20"], ["sampler plate", "$5.80"]].search_menu

{"$10.00"=>nil, "mixed fruit"=>"$2.15", "french fries"=>"$2.75", "side salad"=>"$3.35", "hot wings"=>"$3.55",
"mozzarella sticks"=>"$4.20", "sampler plate"=>"$5.80"}.search_menu

Lastly, the SearchMenu class along with all core extensions can be loaded via a single require.

 require 'search_menu/all'

Please Note

Built with Ruby 2.2.0

SearchMenu expects the first value to be the price. Please see the examples below.

For text files:

$10.00 mixed fruit,$2.15 french fries,$2.75 side salad,$3.35 hot wings,$3.55 mozzarella sticks,$4.20 sampler plate,$5.80 pine cones,$4.20 cat food,$5.80

For an Array:

[["$10.00"], ["mixed fruit", "$2.15"], ["french fries", "$2.75"], ["side salad", "$3.35"], ["hot wings", "$3.55"], ["mozzarella sticks", "$4.20"], ["sampler plate", "$5.80"]]

For a Hash:

{"$10.00"=>nil, "mixed fruit"=>"$2.15", "french fries"=>"$2.75", "side salad"=>"$3.35", "hot wings"=>"$3.55", "mozzarella sticks"=>"$4.20", "sampler plate"=>"$5.80"}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/search_menu/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request