Sha256: b41e9ffe01853e286d1c877e21afe9173fa2315a18486103fc475aac4f742d64
Contents?: true
Size: 842 Bytes
Versions: 17
Compression:
Stored size: 842 Bytes
Contents
module Shamu module Features module Conditions # Match against an environment variable. class Env < Conditions::Condition # (see Condition#match?) def match?( context ) variables.any? { |name, matcher| matcher.call( context.env( name ) ) } end private def variables @variables ||= hash_variables || array_variables end def hash_variables return unless config.is_a?( Hash ) config.each_with_object( {} ) do |(name, value), hash| hash[name] = ->(v) { v == value } end end def array_variables Array( config ).each_with_object( {} ) do |name, hash| hash[name] = ->(v) { v.to_bool } end end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems