Method: WrapIt::Sections::ClassMethods#section

Defined in:
lib/wrap_it/sections.rb

#section([name, ...]) ⇒ void

This method returns an undefined value.

Defines new section or sections. Places its to end of section list

Parameters:

  • name (Symbol, String)

    section name



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/wrap_it/sections.rb', line 110

def section(*args)
  @sections ||= []
  args.flatten.each do |name|
    name.is_a?(String) && name = name.to_sym
    next unless name.is_a?(Symbol)
    next if (sections + [:begin, :end]).include?(name)
    @sections << name
    placement << name unless placement.include?(name)
    place name, before: :end
  end
end