Socket
Book a DemoInstallSign in
Socket

highline_wizard

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highline_wizard

0.0.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

Highline::Wizard

Highline Wizard is a library to help you getting options. That options should be passed as a 2 dimension array.

Installation

Add this line to your application's Gemfile:

gem 'highline-wizard'

And then execute:

$ bundle

Or install it yourself as:

$ gem install highline-wizard

Usage

In your ruby script

require 'highline/wizard'

OPTIONS = [
  %W( icecream chocolate extra-topping 4.5 )
  %W( icecream chocolate no-topping 3.5 )
  %W( cake chocolate no-topping 4.5 )
  %W( cake vanilla no-topping 4.5 )
]

selected = wizzard(OPTIONS) do
  titles << %w(desert flavor extra price)
end

puts selected.inspect

This will generate to the user the following conversation:

1. icecream
2. cake
Choose desert? 2

1. chocolate
2. vanilla
Choose flavor? 1

{ "desert" => "cake", "flavor" => "chocolate", "extra" => "no-toppinng", "price" => "4.5" }

Other option:

1. icecream
2. cake
Choose desert? 1

1. extra-topping
2. no-topping
Choose extra? 2

{ "desert" => "icecream", "flavor" => "chocolate", "extra" => "no-topping", "price" => "4.5" }

As you can see, options that are not possible are not asked.

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 19 Apr 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.