Class: BruteCLI::REPL::FzfMenu::Menu

Inherits:
Object
  • Object
show all
Defined in:
lib/brute_cli/repl/fzf_menu.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title = nil) ⇒ Menu

Returns a new instance of Menu.



39
40
41
42
# File 'lib/brute_cli/repl/fzf_menu.rb', line 39

def initialize(title = nil)
  @title   = title
  @choices = []
end

Instance Attribute Details

#choicesObject (readonly)

Returns the value of attribute choices.



37
38
39
# File 'lib/brute_cli/repl/fzf_menu.rb', line 37

def choices
  @choices
end

#titleObject (readonly)

Returns the value of attribute title.



37
38
39
# File 'lib/brute_cli/repl/fzf_menu.rb', line 37

def title
  @title
end

Instance Method Details

#choice(label, target) ⇒ Object



48
49
50
# File 'lib/brute_cli/repl/fzf_menu.rb', line 48

def choice(label, target)
  @choices << [label, target]
end

#resolved_titleObject



44
45
46
# File 'lib/brute_cli/repl/fzf_menu.rb', line 44

def resolved_title
  @title.respond_to?(:call) ? @title.call : @title.to_s
end