Class: Trestle::Toolbar::Context

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

Overview

The toolbar Context is the object that is yielded to a toolbar block and handles the delegation of builder methods.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder, enumerator, *args) ⇒ Context

Returns a new instance of Context.



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

def initialize(builder, enumerator, *args)
  @builder, @enumerator = builder, enumerator
  @args = args
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



5
6
7
# File 'lib/trestle/toolbar/context.rb', line 5

def builder
  @builder
end

Class Method Details

.ruby2_keywordsObject



24
25
# File 'lib/trestle/toolbar/context.rb', line 24

def self.ruby2_keywords(*)
end

Instance Method Details

#groupObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/trestle/toolbar/context.rb', line 12

def group
  if @current_group
    yield
  else
    @current_group = []
    yield
    @enumerator << @current_group
    @current_group = nil
  end
end