Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Moving the HighLine source from RubyForge

This branch is 0 commits ahead and 0 commits behind master


Read Me

by James Edward Gray II


Welcome to HighLine.

HighLine was designed to ease the tedious tasks of doing console input and output with low-level methods like gets() and puts(). HighLine provides a robust system for requesting data from a user, without needing to code all the error checking and validation rules and without needing to convert the typed Strings into what your program really needs. Just tell HighLine what you're after, and let it do all the work.


See HighLine and HighLine::Question for documentation.


Basic usage:

ask("Company?  ") { |q| q.default = "none" }


ask("Age?  ", Integer) { |q| = 0..105 }
ask("Name?  (last, first)  ") { |q| q.validate = /\A\w+, ?\w+\Z/ }

Type conversion for answers:

ask("Birthday?  ", Date)
ask("Interests?  (comma sep list)  ", lambda { |str| str.split(/,\s*/) })

Reading passwords:

ask("Enter your password:  ") { |q| q.echo = false }
ask("Enter your password:  ") { |q| q.echo = "x" }

ERb based output (with HighLine's ANSI color tools):

say("This should be <%= color('bold', BOLD) %>!")


choose do |menu|
  menu.prompt = "Please choose your favorite programming language?  "

  menu.choice(:ruby) { say("Good choice!") }
  menu.choices(:python, :perl) { say("Not from around here, are you?") }

For more examples see the examples/ directory of this project.


See the INSTALL file for instructions.

Questions and/or Comments

Feel free to email James Edward Gray II or Gregory Brown with any questions.

Something went wrong with that request. Please try again.