Sha256: 157c537a72a1180a42146c32f4862f80f9407eb51bb43ff9820c22305883f601

Contents?: true

Size: 331 Bytes

Versions: 11

Compression:

Stored size: 331 Bytes

Contents

class Hash  
	alias :original_delete :delete

	# support delete more than one keys
	#
	#   original: delete(key)
	#   current:  delete(*keys)
	#
	# return [Hash]
	def delete *keys, &blk
		values = keys.each.with_object [] do |k,m|
			m << original_delete(k, &blk)
		end
		keys.length==1 ? values[0] : values
	end

end # class Hash

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tagen-1.0.3 lib/tagen/core/hash.rb
tagen-1.0.2 lib/tagen/core/hash.rb
tagen-1.0.1 lib/tagen/core/hash.rb
tagen-1.0.0 lib/tagen/core/hash.rb
tagen-0.2.5 lib/tagen/core/hash.rb
tagen-0.2.4 lib/tagen/core/hash.rb
tagen-0.2.3 lib/tagen/core/hash.rb
tagen-0.2.1 lib/tagen/core/hash.rb
tagen-0.2.0 lib/tagen/core/hash.rb
tagen-0.1.1 lib/tagen/core/hash.rb
tagen-0.1.0 lib/tagen/core/hash.rb