Class: CommandDeck::Registry::PanelBuilder
- Inherits:
-
Object
- Object
- CommandDeck::Registry::PanelBuilder
- Defined in:
- lib/command_deck/registry.rb
Overview
Panel builder
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(title, **opts) ⇒ PanelBuilder
constructor
A new instance of PanelBuilder.
- #tab(title, &blk) ⇒ Object
Constructor Details
#initialize(title, **opts) ⇒ PanelBuilder
Returns a new instance of PanelBuilder.
38 39 40 41 42 43 44 |
# File 'lib/command_deck/registry.rb', line 38 def initialize(title, **opts) @title = title @tabs = [] @owner = opts[:owner] @group = opts[:group] @key = opts[:key] || slugify(title) end |
Instance Method Details
#build ⇒ Object
50 51 52 |
# File 'lib/command_deck/registry.rb', line 50 def build Panel.new(title: @title, tabs: @tabs, owner: @owner, group: @group, key: @key) end |
#tab(title, &blk) ⇒ Object
46 47 48 |
# File 'lib/command_deck/registry.rb', line 46 def tab(title, &blk) @tabs << TabBuilder.new(title).tap { |tb| tb.instance_eval(&blk) if blk }.build end |