Skip to content

Commit

Permalink
Merge ed30e8a into 9ae506d
Browse files Browse the repository at this point in the history
  • Loading branch information
Geert Kapteijns committed Jan 28, 2015
2 parents 9ae506d + ed30e8a commit dde5383
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tree.rb
Expand Up @@ -230,7 +230,7 @@ def initialize(name, content = nil)
#
# @return [Tree::TreeNode] A copy of this node.
def detached_copy
Tree::TreeNode.new(@name, @content ? @content.clone : nil)
self.class.new(@name, @content ? @content.clone : nil)
end

# Returns a copy of entire (sub-)tree from this node.
Expand Down
5 changes: 5 additions & 0 deletions test/test_subclassed_node.rb
Expand Up @@ -64,6 +64,11 @@ def test_subclassed_camelcase_methods

end

def test_subclassed_detached_copy_is_same_class
root = MyNode.new("Root")
assert_equal(MyNode, root.detached_copy.class)
end

end
end

Expand Down

0 comments on commit dde5383

Please sign in to comment.