Class: Trestle::Toolbar::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/trestle/toolbar/builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ Builder

Returns a new instance of Builder.



4
5
6
# File 'lib/trestle/toolbar/builder.rb', line 4

def initialize(template)
  @template = template
end

Class Method Details

.builder_method(*methods) ⇒ Object



26
27
28
# File 'lib/trestle/toolbar/builder.rb', line 26

def self.builder_method(*methods)
  self.builder_methods += methods
end

Instance Method Details

#button(label, **options, &block) ⇒ Object



8
9
10
# File 'lib/trestle/toolbar/builder.rb', line 8

def button(label, **options, &block)
  Button.new(@template, label, **options, &block)
end


16
17
18
# File 'lib/trestle/toolbar/builder.rb', line 16

def dropdown(label=nil, **options, &block)
  Dropdown.new(@template, label, **options, &block)
end


12
13
14
# File 'lib/trestle/toolbar/builder.rb', line 12

def link(label, instance_or_url=nil, **options, &block)
  Link.new(@template, label, instance_or_url, **options, &block)
end