Sha256: 05edd209489864df56de94ee16566531fecb01abbf9583849410faeecdc8547d
Contents?: true
Size: 744 Bytes
Versions: 11
Compression:
Stored size: 744 Bytes
Contents
class Evil::Client # Wraps hash of options with railsy methods [#slice] and [#except] # # Both methods works on the root level only. # Nevertheless, this is sufficient to select/reject a part of the whole # options collected from the very root of the client. # class Options < SimpleDelegator # Returns a new hash which include only selected keys # # @param [Object, Array<Object>] keys # @return [Hash] # def slice(*keys) select { |key| keys.flatten.include? key } end # Returns a new hash where some keys are excluded from # # @param [Object, Array<Object>] keys # @return [Hash] # def except(*keys) reject { |key| keys.flatten.include? key } end end end
Version data entries
11 entries across 11 versions & 1 rubygems