Method: MotionPrime::Section#create_elements

Defined in:
motion-prime/sections/base_section.rb

#create_elementsObject

Create elements if they are not created yet. This will not cause rendering elements, they will be rendered immediately after that or rendered async later, based on type of section.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'motion-prime/sections/base_section.rb', line 122

def create_elements
  return if @section_loaded
  if @section_loading
    sleep 0.1
    return @section_loaded ? false : create_elements
  end
  @section_loading = true

  self.elements = {}
  elements_options.each do |key, opts|
    add_element(key, opts)
  end
  elements_eval(&@options_block) if @options_block.is_a?(Proc)

  @section_loading = false
  return @section_loaded = true
end