Questions tagged [highline]

27 questions
43
votes
5 answers

Ruby - Passing Blocks To Methods

I'm trying to do Ruby password input with the Highline gem and since I have the user input the password twice, I'd like to eliminate the duplication on the blocks I'm passing in. For example, a simple version of what I'm doing right now is: new_pass…
Chris Bunch
  • 87,773
  • 37
  • 126
  • 127
7
votes
2 answers

Is there a Python equivalent to HighLine?

HighLine is a Ruby library for easing console input and output. It provides methods that lets you request input and validate it. Is there something that provides functionality similar to it in Python? To show what HighLine does see the following…
N.N.
  • 8,336
  • 12
  • 54
  • 94
5
votes
1 answer

How to remove newline from ask method in Highline library?

I need a way to remove the newline from the ask method included in highline. Here's my current code: pass = ask( "Enter your password > " ) { |passman| passman.echo = false } But whenever I run the that, the output is Enter your password > (typing…
Mark
  • 694
  • 5
  • 15
5
votes
1 answer

Highline ask method won't use same line

Setup: Bash Ruby 1.9.2 highline (1.6.13) Description: I'm fairly used to highline with some other projects, but haven't used it in a few months. Now, on a fresh install on Ruby 1.9.2, it doesn't seem to allow prompts to be answered on the same…
wmarbut
  • 4,595
  • 7
  • 42
  • 72
4
votes
1 answer

Watir changes highline's "ask" method

I've encoutered some strange functionality, when using Watir and Highline together. Here is simple example: require 'highline/import' comp = ask("Company? ") { |q| q.default = "MySuperCompany" } puts comp require 'watir' comp = ask("Company? ") {…
grundic
  • 4,641
  • 3
  • 31
  • 47
2
votes
2 answers

Ruby? How to ignore newlines in cut and pasted user input?

I've written a little Ruby script that requires some user input. I anticipate that users might be a little lazy at some point during the data entry where long entries are required and that they might cut and paste from another document containing…
srboisvert
  • 12,679
  • 15
  • 63
  • 87
2
votes
2 answers

How to stub and mock interactive ruby app with Cucumber?

I have an interactive CLI app based on Highline gem. I can run it interactively for Cucumber tests using Aruba. But I can't using stubs and mocks, because Aruba starts my app as a child process. If I try to use Aruba::InProcess feature, it loses…
Michael
  • 135
  • 2
  • 11
2
votes
4 answers

How can I test rspec user input and output with Highline?

I'd like to test response to user input. That input is queried using Highline: def get_name return HighLine.new.ask("What is your name?") end I'd like to do something similar to this question and put it in my…
Ovesh
  • 5,209
  • 11
  • 53
  • 73
1
vote
1 answer

How to test IO with rspec for HighLine gem?

I have a class: class Asker def initialize @cli = HighLine.new end def exit_or_continue answer = @cli.ask "Type 'quit' to exit at any time, Press 'Enter' to continue" exit(0) if answer == 'quit' end end How could I test the…
Stephen
  • 3,822
  • 2
  • 25
  • 45
1
vote
1 answer

Hover a String in Android

Hello i have a problem for my App. I develop a Online Shopping List for some friends and my family. It works finde but i would implement a new function. I add a listview.setOnItemClickListener in my code. And here comes my…
Lyan
  • 23
  • 3
1
vote
1 answer

Getting 'choice' to work in Highline Ruby Gem without error and getting variable from it

I'm having a couple of problems using Highline in Ruby, and trying to get the choice element, detailed here, to work. At the moment the following code produces the error "error: wrong number of arguments (0 for 1). Use --trace to view…
Alex
  • 193
  • 2
  • 2
  • 9
1
vote
1 answer

Highline ruby gem. How to provide a variable number of menu choices at runtime

My first ever stack overflow post. I am supposed to be succinct and to the point, but please indulge me in some background the first time around. I have been programming in C and Visual Basic for 16 years, but only part time to support my work as a…
Juz0
  • 13
  • 2
1
vote
1 answer

How can I test Cucumber user input and output with Highline?

I try several ways like stubbing STDOUT, using highline-test and aruba gems, but it still stops my cucumber tests and asking for user input. Are there best practices for testing such applications with Cucumber?
Michael
  • 135
  • 2
  • 11
1
vote
1 answer

Ruby script does not work with weird errors about highline library

I have the following Ruby script: begin puts "What is the password? " the_pass = ask("") { |q| q.echo = "*" } end while the_pass == nil || the_pass == "\n" || the_pass == "" And it fails when I hit Enter: undefined method…
hzxu
  • 5,753
  • 11
  • 60
  • 95
0
votes
2 answers

Ruby gem - Highline and downcase?

I have been searching frustratingly for hours and just can not seem to find out how to change the input from the ask function. input = ask ("Input text: ") If anybody can help a newbie out that would be amazing! I've also provided a script link…
1
2