Sha256: 910a333662dc9b3f665c9d8b02d5f95faf8dea5179d066bfe691e7698536c004
Contents?: true
Size: 723 Bytes
Versions: 1
Compression:
Stored size: 723 Bytes
Contents
# frozen_string_literal: true module Tataru # Requirements DSL class RequirementsDSL attr_reader :resource_list def initialize(resource_finder) @resource_finder = resource_finder @resource_list = {} end def respond_to_missing? true end def method_missing(type, name, &block) rclass = @resource_finder.resource_named(type) res = ResourceDSL.new(rclass.new) res.instance_exec(&block) if block @resource_list[name] = { type: type, dependencies: res.dependencies, state: res.fields, errors: res.errors } rescue NameError super end def errors @resource_list.flat_map { |_, v| v[:errors] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tataru-0.1.0 | lib/tataru/requirements_dsl.rb |