class ZAWS::Helper::Option

Public Class Methods

absent(optarr, opt_hash) click to toggle source
# File lib/zaws/helper/option.rb, line 9
def self.absent(optarr, opt_hash)
  optarr.inject([]) { |missing, opt| opt_hash[opt] ? missing : missing << opt }
end
exclusive?(optarr, opt_hash) click to toggle source
# File lib/zaws/helper/option.rb, line 13
def self.exclusive?(optarr, opt_hash)
  (optarr.inject(0) { |total, opt| opt_hash[opt] ? total + 1 : total }) <= 1
end
exists?(optarr, opt_hash) click to toggle source
# File lib/zaws/helper/option.rb, line 5
def self.exists?(optarr, opt_hash)
  optarr.all? { |opt| opt_hash[opt] }
end
minimum?(min, optarr, opt_hash) click to toggle source
# File lib/zaws/helper/option.rb, line 17
def self.minimum?(min, optarr, opt_hash)
  (optarr.inject(0) { |total, opt| opt_hash[opt] ? total + 1 : total }) >= min
end