Sha256: ea055fb16770c81bc361cc85e0bbac86c82fd7ab92ba9bab41ebf32e6391eb2e
Contents?: true
Size: 893 Bytes
Versions: 5
Compression:
Stored size: 893 Bytes
Contents
module Trailblazer class Activity # Config API allows you to read and write immutably to the activity's # {:config} field. Most of the times, this only contains {:wrap_static}. module Config module_function def set(config, *args) if args.size == 2 key, value = *args config = config.merge(key => value) else directive, key, value = *args config = config.merge( directive => {}.freeze ) unless config.key?(directive) directive_hash = config[directive].merge(key => value) config = config.merge( directive => directive_hash.freeze ) end config end def get(config, *args) directive, key = *args return config[directive] if args.size == 1 return config[directive][key] if config.key?(directive) nil end end end end
Version data entries
5 entries across 5 versions & 1 rubygems