Skip to content

ask: add support for default answer.#2

Merged
trans merged 2 commits into
rubyworks:masterfrom
weakish:ask-default-answer
Dec 27, 2014
Merged

ask: add support for default answer.#2
trans merged 2 commits into
rubyworks:masterfrom
weakish:ask-default-answer

Conversation

@weakish
Copy link
Copy Markdown
Contributor

@weakish weakish commented Dec 23, 2014

No description provided.

@trans
Copy link
Copy Markdown
Member

trans commented Dec 23, 2014

Let me think about this one. My reservation is that not all questions are are necessarily "Y/N". So the default default might be better off as nil. That way one can do:

  if answer = ask("Some question?")
    # do something with answer
  else
    # no answer
  end

As @trans pointed out: not not all questions are necessarily "Yn".
And if default answer is nil, one can do

```ruby
if answer = ask("Some question?")
  # do something with answer
else
  # no answer
end
```
@weakish
Copy link
Copy Markdown
Contributor Author

weakish commented Dec 24, 2014

@trans Thanks for pointing out this. I hadn't considered non Yn questions.

I pushed a new commit, please review.

trans added a commit that referenced this pull request Dec 27, 2014
Add support for default answer to ask.
@trans trans merged commit 0df033c into rubyworks:master Dec 27, 2014
@trans
Copy link
Copy Markdown
Member

trans commented Dec 27, 2014

Yep. I think that's the way to go. Thanks for doing this. I'll prepare a new release shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants