Sha256: ad3c149c444e26fbfc36ef7e4bbfeaa217318886d524ea7a7bc6830e131a96c2
Contents?: true
Size: 595 Bytes
Versions: 9
Compression:
Stored size: 595 Bytes
Contents
class Miam::DSL::Context::Group def initialize(name, &block) @group_name = name @result = {:policies => {}} instance_eval(&block) end attr_reader :result private def policy(name) name = name.to_s if @result[:policies][name] raise "Group `#{@group_name}` > Policy `#{name}`: already defined" end policy_document = yield unless policy_document.kind_of?(Hash) raise "Group `#{@group_name}` > Policy `#{name}`: wrong argument type #{policy_document.class} (expected Hash)" end @result[:policies][name] = policy_document end end
Version data entries
9 entries across 9 versions & 1 rubygems