D
Daniel Schierbeck
Is there a reason why there doesn't exist a delete_unless method in
Array and Hash? I think it's quite handy. It's also easy to implement
(in ruby):
class Array
def delete_unless (&block)
delete_if { |element| not block.call(element) }
end
end
class Hash
def delete_unless (&block)
delete_if { |key, value| not block.call(key, value) }
end
end
Daniel
Array and Hash? I think it's quite handy. It's also easy to implement
(in ruby):
class Array
def delete_unless (&block)
delete_if { |element| not block.call(element) }
end
end
class Hash
def delete_unless (&block)
delete_if { |key, value| not block.call(key, value) }
end
end
Daniel