Class: MrT::ActionRegistry::ActionSelector
- Inherits:
-
Object
- Object
- MrT::ActionRegistry::ActionSelector
- Includes:
- Selector
- Defined in:
- lib/mrT/selector.rb
Instance Method Summary (collapse)
-
- (ActionSelector) initialize(actions)
constructor
A new instance of ActionSelector.
- - (Object) items
- - (Object) selected(ui) (also: #action)
Methods included from Selector
/, #actions, #filter, #interact, #matcher, #matching_actions, #memoized_items, #pattern, #prepare, #prepared?, #prompt, sources
Constructor Details
- (ActionSelector) initialize(actions)
A new instance of ActionSelector
184 185 186 |
# File 'lib/mrT/selector.rb', line 184 def initialize(actions) @actions = actions end |
Instance Method Details
- (Object) items
188 189 190 |
# File 'lib/mrT/selector.rb', line 188 def items @actions.map { |a| "%-15s %-30s" % [a.name, a.desc] } end |
- (Object) selected(ui) Also known as: action
192 193 194 |
# File 'lib/mrT/selector.rb', line 192 def selected(ui) @actions[memoized_items.index(ui.selected)] end |