Method: Hash#values_at

Defined in:
lib/source/ruby.rb

#values_at(*args) ⇒ Object

call-seq:

hsh.values_at(key, ...) -> array

Returns an array containing the values associated with the given keys. See also Hash.select.

h = {:a => 100, :b => 200, :c => 300}

h.values_at(:a,:c)    #=> [100,300]


3879
3880
3881
3882
# File 'lib/source/ruby.rb', line 3879

def values_at(*args)
  `for(var i=0,l=args.length,c=this.__contents__,d=this.__default__,result=[];i<l;++i){var h=args[i].m$hash(),kv=c[h];result.push(kv?kv[1]:(typeof(d)=='function'?d(this,args[i]):d))}`
  return `result`
end