lib/compo/composite.rb in compo-0.1.0 vs lib/compo/composite.rb in compo-0.1.1

- old
+ new

@@ -32,11 +32,11 @@ # to the child via #update_parent. # @param child [Object] The child to add to this Composite. # # @return [Object] The added child if successful; nil otherwise. def add(id, child) - add!(id, child).tap(&method(:assign_parent)) + add!(id, child).tap(&method(:assign_parent_to)) end # Removes a child from this Composite directly # # This method can fail (for example, if the child does not exist in the @@ -48,11 +48,11 @@ # # @param child [Object] The child to remove from this object. # # @return [Object] The removed child if successful; nil otherwise. def remove(child) - remove!(child).tap(&method(:remove_parent)) + remove!(child).tap(&method(:remove_parent_of)) end # Removes a child from this Composite, given its ID # # This method can fail (for example, if the ID does not exist in the @@ -64,11 +64,11 @@ # # @param id The ID of the child to remove from this object. # # @return [Object] The removed child if successful; nil otherwise. def remove_id(id) - remove_id!(id).tap(&method(:remove_parent)) + remove_id!(id).tap(&method(:remove_parent_of)) end def_delegator :children, :each protected @@ -81,11 +81,11 @@ # @api private # # @param child [Object] The child whose parent assignment is being set. # # @return [void] - def assign_parent(child) + def assign_parent_to(child) child.update_parent(self, id_function(child)) unless child.nil? end # Removes a child's parent assignment # @@ -94,10 +94,10 @@ # @api private # # @param child [Object] The child whose parent assignment is being set. # # @return [void] - def remove_parent(child) + def remove_parent_of(child) child.remove_parent unless child.nil? end # Default implementation of #remove! in terms of #remove_id! #