Class: Ukiryu::Models::VersionDetection

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ukiryu/models/version_detection.rb

Overview

Version detection configuration

Examples:

Command-based version detection (GNU tools)

vd = VersionDetection.new(
  command: '--version',
  pattern: '(\d+\.\d+)',
  modern_threshold: '7.0'
)

Man-page based version detection (BSD/system tools)

vd = VersionDetection.new(
  command: ['man', 'find'],
  pattern: 'macOS ([\d.]+)',
  source: 'man'
)

Fallback hierarchy with detection_methods array

vd = VersionDetection.new(
  detection_methods: [
    VersionDetectionMethod.new(type: 'command', command: '--version', pattern: '(\d+\.\d+)'),
    VersionDetectionMethod.new(type: 'man_page', paths: { macos: '/usr/share/man/man1/xargs.1' })
  ]
)

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object

Hash-like access for Base.detect_version compatibility

Parameters:

  • key (Symbol, String)

    the attribute key

Returns:

  • (Object)

    the attribute value



64
65
66
67
68
69
70
# File 'lib/ukiryu/models/version_detection.rb', line 64

def [](key)
  key_sym = key.to_sym
  # Return nil for unknown keys
  return nil unless respond_to?(key_sym, true)

  send(key_sym)
end