Class: Interactive::NonEmptyOptions

Inherits:
SimpleDelegator
  • Object
show all
Includes:
Interactive
Defined in:
lib/interactive/options.rb

Direct Known Subclasses

TabularOptions

Constant Summary

Constants included from Interactive

VERSION

Instance Method Summary collapse

Methods included from Interactive

Option, Options, Response

Constructor Details

#initialize(options) ⇒ NonEmptyOptions

Returns a new instance of NonEmptyOptions.



18
19
20
21
22
23
# File 'lib/interactive/options.rb', line 18

def initialize(options)
  @options = options
  flatten_ranges(@options)
  wrap_each_option
  super(@options)
end

Instance Method Details

#has_hash?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/interactive/options.rb', line 33

def has_hash?
  @options.any? {|opt| opt.respond_to?(:to_hash) }
end

#shortcuts_meaningsObject



29
30
31
# File 'lib/interactive/options.rb', line 29

def shortcuts_meanings
  @options.inject("") { |accum, opt| "#{accum}  #{opt.shortcut_value} -- #{opt.value}\n"}
end

#shortcuts_stringObject



25
26
27
# File 'lib/interactive/options.rb', line 25

def shortcuts_string
  "[#{OptionsShortcuts.new(first_chars_without_last_slash(first_chars)).minify}]"
end