Class: RosettAi::Compiler::CompiledOutput

Inherits:
Struct
  • Object
show all
Defined in:
lib/rosett_ai/compiler/compiled_output.rb

Overview

Value object representing a single compiled output file.

Replaces the raw Hash previously returned by BehaviourCompiler#compile. Struct supports both .field and [:field] access, so callers using info[:content] continue to work without modification.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def category
  @category
end

#contentObject

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def content
  @content
end

#enabled_rules_countObject

Returns the value of attribute enabled_rules_count

Returns:

  • (Object)

    the current value of enabled_rules_count



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def enabled_rules_count
  @enabled_rules_count
end

#filenameObject

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def filename
  @filename
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def name
  @name
end

#rules_countObject

Returns the value of attribute rules_count

Returns:

  • (Object)

    the current value of rules_count



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def rules_count
  @rules_count
end

#scopeObject

Returns the value of attribute scope

Returns:

  • (Object)

    the current value of scope



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def scope
  @scope
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def source
  @source
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



13
14
15
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 13

def version
  @version
end

Instance Method Details

#to_lockfile_hash(display_path:, source_path:, content_checksum:, timestamp:) ⇒ Hash

Builds a lockfile entry hash for this compiled output.

Parameters:

  • display_path (String)

    display prefix for output path

  • source_path (String)

    relative source path

  • content_checksum (String)

    SHA-256 hex digest of content

  • timestamp (String)

    ISO 8601 compilation timestamp

Returns:

  • (Hash)

    lockfile entry



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rosett_ai/compiler/compiled_output.rb', line 24

def to_lockfile_hash(display_path:, source_path:, content_checksum:, timestamp:)
  entry = {
    'version' => version,
    'source' => source_path,
    'output' => "#{display_path}/#{filename}",
    'checksum' => "sha256:#{content_checksum}",
    'compiled_at' => timestamp,
    'rules_count' => rules_count,
    'enabled_rules_count' => enabled_rules_count
  }
  entry['scope'] = scope if scope
  entry
end