method
select!
ruby latest stable - Class:
Hash
select!()public
Equivalent to Hash#keep_if, but returns nil if no changes were made.
VALUE
rb_hash_select_bang(VALUE hash)
{
st_index_t n;
RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_modify_check(hash);
if (!RHASH(hash)->ntbl)
return Qnil;
n = RHASH(hash)->ntbl->num_entries;
rb_hash_foreach(hash, keep_if_i, hash);
if (n == RHASH(hash)->ntbl->num_entries) return Qnil;
return hash;
} Related methods
- Instance methods
- <
- <=
- ==
- >
- >=
- []
- []=
- any?
- assoc
- clear
- compact
- compact!
- compare_by_identity
- compare_by_identity?
- default
- default=
- default_proc
- default_proc=
- delete
- delete_if
- dig
- each
- each_key
- each_pair
- each_value
- empty?
- eql?
- fetch
- fetch_values
- flatten
- has_key?
- has_value?
- hash
- include?
- index
- initialize_copy
- inspect
- invert
- keep_if
- key
- key?
- keys
- length
- member?
- merge
- merge!
- pretty_print
- pretty_print_cycle
- rassoc
- rehash
- reject
- reject!
- replace
- select
- select!
- shift
- size
- slice
- store
- to_a
- to_h
- to_hash
- to_proc
- to_s
- transform_keys
- transform_keys!
- transform_values
- transform_values!
- update
- value?
- values
- values_at
- Class methods
- []
- new
- try_convert