lib/xamplr/templates/child_indexed.template in xamplr-1.2.0 vs lib/xamplr/templates/child_indexed.template in xamplr-1.3.15
- old
+ new
@@ -28,11 +28,11 @@
existing = @#{element.attribute_name}_child[index]
return existing if existing == #{element.attribute_name}
- self.remove_#{element.attribute_name}(index) if existing
+ self.remove_#{element.attribute_name}(index) if existing
@children << #{element.attribute_name}
@#{element.attribute_name}_child[index] = #{element.attribute_name}
#{element.attribute_name}.add_parent(self)
@@ -60,11 +60,11 @@
def ensure_#{element.attribute_name}(index)
accessed
#{element.attribute_name} = @#{element.attribute_name}_child[index]
- return #{element.attribute_name} if #{element.attribute_name}
+ return #{element.attribute_name} if #{element.attribute_name}
|
|if @element.persisted then
|
#{element.attribute_name} = #{element.class_name}.lookup(index) if Xampl.persister and Xampl.persister.automatic
@@ -73,17 +73,17 @@
|
#{element.attribute_name} = #{element.class_name}.new(index) unless #{element.attribute_name}
yield(#{element.attribute_name}) if block_given?
return add_#{element.attribute_name}(#{element.attribute_name})
- end
+ end
def remove_#{element.attribute_name}(index)
accessed
- changed
- unless String === index or Symbol === index then
+ changed
+ unless String === index or Symbol === index then
index = index.get_the_index
- end
+ end
#{element.attribute_name} = @#{element.attribute_name}_child.delete(index) if index
@children.delete(#{element.attribute_name})
end
end