@@ -53,18 +53,20 @@ def add(child, at_index = -1)
5353
5454 # Lazy man's unique test, won't test if children of child are unique in
5555 # this tree too.
56- raise "Child #{ child . name } already added!" \
57- if @children_hash . include? ( child . name )
56+ raise "Child #{ child . name } already added!" if @children_hash . include? ( child . name )
5857
5958 child . parent &.remove! child # Detach from the old parent
6059
6160 if insertion_range . include? ( at_index )
6261 @children . insert ( at_index , child )
6362 else
64- raise 'Attempting to insert a child at a non-existent location' \
65- " (#{ at_index } ) " \
66- 'when only positions from ' \
67- "#{ insertion_range . min } to #{ insertion_range . max } exist."
63+ message = [
64+ 'Attempting to insert a child at a non-existent location' ,
65+ "(#{ at_index } )" ,
66+ 'when only positions from' ,
67+ "#{ insertion_range . min } to #{ insertion_range . max } exist."
68+ ] . join ( ' ' )
69+ raise message
6870 end
6971
7072 @children_hash [ child . name ] = child
@@ -95,11 +97,11 @@ def rename(new_name)
9597
9698 # Renames the specified child node
9799 def rename_child ( old_name , new_name )
98- raise ArgumentError , "Invalid child name specified: #{ old_name } " \
99- unless @children_hash . key? ( old_name )
100+ raise ArgumentError ,
101+ "Invalid child name specified: #{ old_name } " unless @children_hash . key? ( old_name )
100102
101- raise ArgumentError , "Child name already exists: #{ new_name } " \
102- if @children_hash . key? ( new_name )
103+ raise ArgumentError ,
104+ "Child name already exists: #{ new_name } " if @children_hash . key? ( new_name )
103105
104106 @children_hash [ new_name ] = @children_hash . delete ( old_name )
105107 @children_hash [ new_name ] . name = new_name
@@ -180,7 +182,7 @@ def clear_root_cache!
180182 def invalidate_size_cache_upwards!
181183 node = self
182184 while node
183- node . instance_variable_set ( :@node_size , nil )
185+ node . instance_variable_set ( :@size , nil )
184186 node = node . parent
185187 end
186188 end
0 commit comments