Class: LcpRuby::Dsl::DslLoader::TypeEvalContext

Inherits:
Object
  • Object
show all
Defined in:
lib/lcp_ruby/dsl/dsl_loader.rb

Overview

Isolated evaluation context for type DSL files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTypeEvalContext

Returns a new instance of TypeEvalContext.



289
290
291
# File 'lib/lcp_ruby/dsl/dsl_loader.rb', line 289

def initialize
  @type_definitions = []
end

Instance Attribute Details

#type_definitionsObject (readonly)

Returns the value of attribute type_definitions.



287
288
289
# File 'lib/lcp_ruby/dsl/dsl_loader.rb', line 287

def type_definitions
  @type_definitions
end

Instance Method Details

#define_type(name, &block) ⇒ Object



293
294
295
296
297
298
# File 'lib/lcp_ruby/dsl/dsl_loader.rb', line 293

def define_type(name, &block)
  builder = TypeBuilder.new(name)
  builder.instance_eval(&block)
  hash = builder.to_hash
  @type_definitions << Types::TypeDefinition.from_hash(hash)
end