def initialize element_name, options = {}
@element_name = element_name
@context = options[:context]
@parent_frame = options[:parent_frame]
@root_frame = options[:root_frame]
@wrapper_frames = {}
if @parent_frame
@customizations = @parent_frame.customizations_for_child(element_name)
else
@customizations = options[:customizations]
@root_frame ||= self
end
if @root_frame == self and
indexes = @customizations[:index_names]
indexes.each do |name|
if context.kind_of?(Context)
context.__set_data__(name, {})
else
add_mutators(name)
context.send("#{name}=", {})
end
end
end
@customizations[:children].keys.each do |child_element_name|
consume_initial_frame(build_child_frame(child_element_name))
end
if @customizations[:wrapper_frames]
@customizations[:wrapper_frames].keys.each do |method_name|
consume_initial_frame(wrapper_frame_for(method_name))
end
end
end