The reason you attempt doesn't work is that hash keys can actually be any kind of object and Hash#slice will compare them by identity:
# its a hash with array keys - crazy stuff.
=> {[1, 2, 3]=>"a", [3, 4, 5]=>"b"}
irb(main):012:0> hash.slice([1,2,3])
=> {[1, 2, 3]=>"a"}
# [1,2,3] and [1,2] are not equal
irb(main):013:0> hash.slice([1,2])
=> {}
irb(main):014:0> hash.slice([3,4,5])
=> {[3, 4, 5]=>"b"}
irb(main):015:0>
An array will never be equal to a string in Ruby.
If you want to convert an array into a list of arguments to pass to a method use the splat operator (*):
irb(main):022:0> h = {"video"=>"MP4","audio"=>"MP3", "sharing"=>"NONE", "mix"=>"NONE"}
=> {"video"=>"MP4", "audio"=>"MP3", "sharing"=>"NONE", "mix"=>"NONE"}
irb(main):023:0> a = ["video", "audio", "txt"]
=> ["video", "audio", "txt"]
irb(main):024:0> h.slice(*a)
=> {"video"=>"MP4", "audio"=>"MP3"}
a = ["video", "audio", "txt"]({"video", "audio", "txt"}is an invalid expression). If you want all keys ofhthat are ina,h.keys & a #=> ["video", "audio"]. If you want all key-value pairs inhfor which the key is ina,h.slice(*a) #=> {"video"=>"MP4", "audio"=>"MP3"}.