Class: Tabry::OptionsFinder
- Inherits:
-
Object
- Object
- Tabry::OptionsFinder
- Defined in:
- lib/tabry/options_finder.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Class Method Summary collapse
-
.options(result, token) ⇒ Object
Returns an array of options.
Instance Method Summary collapse
-
#initialize(result) ⇒ OptionsFinder
constructor
A new instance of OptionsFinder.
- #options(token) ⇒ Object
Constructor Details
#initialize(result) ⇒ OptionsFinder
Returns a new instance of OptionsFinder.
14 15 16 |
# File 'lib/tabry/options_finder.rb', line 14 def initialize(result) @result = result end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
7 8 9 |
# File 'lib/tabry/options_finder.rb', line 7 def result @result end |
Class Method Details
.options(result, token) ⇒ Object
Returns an array of options
10 11 12 |
# File 'lib/tabry/options_finder.rb', line 10 def self.(result, token) new(result).(token) end |
Instance Method Details
#options(token) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tabry/options_finder.rb', line 18 def (token) # Bit of a hack: send this down to autocomplete shell commands # TODO: set this only in ShellOption -- would require passing state down on thru ENV["TABRY_AUTOCOMPLETE_STATE"] = { cmd: result.config.cmd, flags: result.state.flags, args: result.state.args, current_flag: result.state.current_flag }.to_json send(:"options_#{state.mode}", token || "") end |