Module: Interactive
- Included in:
- NonEmptyOptions
- Defined in:
- lib/interactive/option.rb,
lib/interactive/options.rb,
lib/interactive/version.rb,
lib/interactive/question.rb,
lib/interactive/response.rb
Defined Under Namespace
Classes: EmptyOptions, HashNumberedOption, NonEmptyOptions, Question, ResponseWithArgs, ResponseWithNoArgs, WholeNumberOption, WordOption
Constant Summary
collapse
- VERSION =
"0.4.0"
Class Method Summary
collapse
Class Method Details
.Option(option) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/interactive/option.rb', line 6
def Option(option)
if option.respond_to?(:to_hash)
@option = HashNumberedOption.new(option)
elsif option.to_s.match(/^\d+$/)
@option = WholeNumberOption.new(option)
else
@option = WordOption.new(option)
end
@option
end
|
.Options(options = []) ⇒ Object
6
7
8
|
# File 'lib/interactive/options.rb', line 6
def Options(options=[])
options.empty? ? EmptyOptions.new([]) : NonEmptyOptions.new(options)
end
|
.Response(*args) ⇒ Object
6
7
8
9
|
# File 'lib/interactive/response.rb', line 6
def Response(*args)
args = Array(args).flatten
args.empty? ? ResponseWithNoArgs.new(args) : ResponseWithArgs.new(args)
end
|