Class: CommandDeck::Registry::TabBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/command_deck/registry.rb

Overview

Tab builder

Instance Method Summary collapse

Constructor Details

#initialize(title) ⇒ TabBuilder

Returns a new instance of TabBuilder.



63
64
65
66
# File 'lib/command_deck/registry.rb', line 63

def initialize(title)
  @title = title
  @actions = []
end

Instance Method Details

#action(title, key:, &blk) ⇒ Object



68
69
70
# File 'lib/command_deck/registry.rb', line 68

def action(title, key:, &blk)
  @actions << ActionBuilder.new(title, key).tap { |ab| ab.instance_eval(&blk) if blk }.build
end

#buildObject



72
73
74
# File 'lib/command_deck/registry.rb', line 72

def build
  Tab.new(title: @title, actions: @actions)
end