Skip to content

gather attribute does not work with menu #48

@smackesey

Description

@smackesey

The RDoc says to use the gather attribute of a Question to select multiple items. This works when using ask, but it fails when using choose. This seems odd since Menu (passed to the choose block) inherits from Question (passed to the ask block)

This code

#!/usr/bin/env ruby

require 'highline/import'
require 'rb-readline'

choices = %w[ rabbit caterpillar frog ]

x = choose do |menu|
  menu.prompt = "Animal?  "
  menu.choices(*choices)
  menu.gather = 3
end

generates, after entering three choices, this error:

/Users/seanmackesey/.rvm/gems/ruby-1.9.3-p194/gems/highline-1.6.15/lib/highline/menu.rb:303:in `[]': no implicit conversion from nil to integer (TypeError)

It seems like menu should work with gather. Is it not intended to? You also get an error if you set gather to a string/regexp.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions