Sha256: e40988de6764668b371f9333f917dc8669637199e362757cb651582426c3e108
Contents?: true
Size: 736 Bytes
Versions: 2
Compression:
Stored size: 736 Bytes
Contents
class Miam::DSL::Context::User def initialize(name, &block) @name = name @result = {:groups => [], :policies => {}} instance_eval(&block) end attr_reader :result private def login_profile(value) @result[:login_profile] = value end def groups(*grps) @result[:groups].concat(grps.map {|i| i.to_s }) end def policy(name) name = name.to_s if @result[:policies][name] raise "User `#{name}` > Policy `#{name}`: already defined" end policy_document = yield unless policy_document.kind_of?(Hash) raise "User `#{name}` > Policy `#{name}`: wrong argument type #{policy_document.class} (expected Hash)" end @result[:policies][name] = policy_document end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
miam-0.1.0 | lib/miam/dsl/context/user.rb |
miam-0.1.0.beta | lib/miam/dsl/context/user.rb |