class Cl::Opts::Validate::Validator
Public Instance Methods
compact(hash, *keys)
click to toggle source
# File lib/cl/opts/validate.rb, line 16 def compact(hash, *keys) hash.reject { |_, value| value.nil? }.to_h end
invert(hash)
click to toggle source
# File lib/cl/opts/validate.rb, line 20 def invert(hash) hash.map { |key, obj| Array(obj).map { |obj| [obj, key] } }.flatten(1).to_h end
only(hash, *keys)
click to toggle source
# File lib/cl/opts/validate.rb, line 24 def only(hash, *keys) hash.select { |key, _| keys.include?(key) }.to_h end