Sha256: 6b5fe75fb477c40f77acf5a3ae017f3cb0142e500dd012d681cf708426802422
Contents?: true
Size: 857 Bytes
Versions: 1
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true module Tataru # human representation of resources class TopDsl attr_reader :resources def initialize(pool) @resources = {} @pool = pool end def resource(symbol, name, &block) unless @pool.resource_desc_exist?(symbol) raise "no such resource: #{symbol}" end raise "already defined: #{name}" if @resources.key? name resource = ResourceDsl.new(name, @pool.resource_desc_for(symbol).new) resource.instance_eval(&block) if block @resources[name] = resource.representation end def dep_graph @resources.map do |name, resource_representation| deps = Set.new resource_representation.properties.each do |_key, value| deps += value.dependencies end [name, deps.to_a] end.to_h end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tataru-0.2.0 | lib/tataru/top_dsl.rb |