Sha256: 89f5c466536e0e6a03dfe279d7308d53b65fb6f31307253d40f6de9419e98afd
Contents?: true
Size: 920 Bytes
Versions: 1
Compression:
Stored size: 920 Bytes
Contents
module Trailblazer::V2_1 module Activity::State # Compile-time # # DISCUSS: we could replace parts with Hamster::Hash. class Config def self.build(variables={}) Hash[ variables.collect { |k,v| [k, v.freeze] } ].freeze end def self.[]=(state, *args) if args.size == 2 key, value = *args state = state.merge(key => value) else directive, key, value = *args state = state.merge( directive => {}.freeze ) unless state.key?(directive) directive_hash = state[directive].merge(key => value) state = state.merge( directive => directive_hash.freeze ) end state end def self.[](state, *args) directive, key = *args return state[directive] if args.size == 1 return state[directive][key] if state.key?(directive) nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trailblazer-future-2.1.0.rc1 | lib/trailblazer/v2_1/activity/config.rb |