fork download
  1. #!/usr/bin/ruby -w
  2. # answer: http://o...content-available-to-author-only...e.jp/qa/q7042610.html
  3.  
  4. p [3, 4].all?{|v|[1, 2, 3, 4, 5].include? v}
  5. p [3, 4].all?{|v|[1, 2, 5].include? v}
  6. p [3, 4].all?{|v|[1, 2, 3, 5].include? v}
  7.  
  8. module Enumerable
  9. def include_all?(*values)
  10. values.all?{|v|include? v}
  11. end
  12. end
  13.  
  14. p [1, 2, 3, 4, 5].include_all?(3, 4)
  15. p [1, 2, 5].include_all?(3, 4)
  16. p [1, 2, 3, 5].include_all?(3, 4)
Success #stdin #stdout 0s 4760KB
stdin
Standard input is empty
stdout
true
false
false
true
false
false