Returns a new Hash with only the selected keys:
{ :one => 1, :two => 2, :three => 3 }.only(:one) #=> { :one => 1 }
Source Code
# File merb/core_ext/hash.rb, line 117 def only(*allowed) reject { |k,v| !allowed.include?(k) } end
Returns a new Hash with only the selected keys:
{ :one => 1, :two => 2, :three => 3 }.only(:one) #=> { :one => 1 }
# File merb/core_ext/hash.rb, line 117 def only(*allowed) reject { |k,v| !allowed.include?(k) } end
<code/>and<pre/>for code samples.