On Fri, May 12, 2006 at 06:27:13AM +0900, Berger, Daniel wrote:
} The 'Sharp knives and glue' thread inspired this. It's probably been
} done before but here's my implementation of a final and/or closed class:
}
} # Make a class unsubclassable
[...]
} # Close a class (no method definitions or redefinitions)
[...]
} class Foo
} def test
} puts "hello"
} end
} close(self) # No method additions/redefinitions allowed
} end
[...]
class Foo
def test
puts "hello"
end
freeze #this already exists and does what you want
end
} Regards,
} Dan
--Greg