compact()
Instance Public methods
Returns a hash with non nil
values.
1 2 3 4 | hash = { a: true , b: false , c: nil } hash.compact # => { a: true, b: false} hash # => { a: true, b: false, c: nil} { c: nil }.compact # => {} |
Returns a hash with non nil
values.
1 2 3 4 | hash = { a: true , b: false , c: nil } hash.compact # => { a: true, b: false} hash # => { a: true, b: false, c: nil} { c: nil }.compact # => {} |
Designed by : w10schools
service@w10schools.com
Please login to continue.