Sha256: 746946211cce2012b0e9f9c2218927c1b6a7fd971cb40009c530ae0340df5e49

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

module Tataru
  # tataru
  class Quest
    attr_reader :dsl

    def initialize(pool, current_state = {})
      @pool = pool
      @current_state = current_state
      @dsl = TopDsl.new(pool)
    end

    def construct(&block)
      @dsl.instance_eval(&block)
    end

    def extant_resources
      @current_state.map do |resname, info|
        [resname, info[:desc]]
      end.to_h
    end

    def remote_ids
      @current_state.map do |resname, info|
        [resname, info[:name]]
      end.to_h
    end

    def extant_dependencies
      @current_state.map do |resname, info|
        [resname, info[:dependencies]]
      end.to_h
    end

    def instr_hash
      c = Compiler.new(@dsl, extant_resources, extant_dependencies)
      result = c.instr_hash
      result[:init][:remote_ids] = remote_ids
      result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tataru-0.2.0 lib/tataru/quest.rb