Module: Legate::Tool::MetadataDsl

Included in:
Legate::Tool
Defined in:
lib/legate/tool/metadata_dsl.rb

Overview

Module to provide a more concise DSL for defining tool metadata.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/legate/tool/metadata_dsl.rb', line 7

def self.included(base)
  base.extend ClassMethods

  # Define class instance variable accessors on the base class singleton
  # These are primarily for the *new* DSL
  class << base
    # Replaced attr_accessor with manual methods to handle cache invalidation
    # attr_accessor :explicit_tool_name, :description, :parameters_definition

    attr_reader :explicit_tool_name, :description, :parameters_definition

    def explicit_tool_name=(value)
      @explicit_tool_name = value
      @_tool_metadata_cache = nil # Invalidate cache
    end

    def description=(value)
      @description = value
      @_tool_metadata_cache = nil # Invalidate cache
    end

    def parameters_definition=(value)
      @parameters_definition = value
      @_tool_metadata_cache = nil # Invalidate cache
    end

    # Initialize with default values to ensure methods don't fail on nil
    # Note: These are instance variables of the singleton class (class instance variables)
    def initialize_dsl_storage
      @explicit_tool_name ||= nil
      @description ||= nil # DSL description storage
      @parameters_definition ||= {} # DSL parameters storage
    end
  end
end