Class: Templator::DslContext

Inherits:
Object
  • Object
show all
Defined in:
lib/templator/parameter_dsl.rb

Overview

Context used by the DSL methods to retrieve and update the current group.

Class Method Summary collapse

Class Method Details

.current_groupGroup

Retrieve the current group from the context

Returns:

  • (Group)

    the current group



116
117
118
# File 'lib/templator/parameter_dsl.rb', line 116

def self.current_group
  group_stack.last
end

.enter_group(group) ⇒ Object

Enter a new group. This method shall be called by the DSL methods whenever a new group is entered.

Parameters:

  • group (Group)

    group entered.



130
131
132
# File 'lib/templator/parameter_dsl.rb', line 130

def self.enter_group(group)
  group_stack.push(group)
end

.leave_groupObject

Leave a group. This method shall be calles by the DSL methods whenever a group is left.



137
138
139
# File 'lib/templator/parameter_dsl.rb', line 137

def self.leave_group
  group_stack.pop
end

.top_level_groupGroup

Retrieve the top level group from the context

Returns:

  • (Group)

    the top level group



122
123
124
# File 'lib/templator/parameter_dsl.rb', line 122

def self.top_level_group
  group_stack.first
end