Class: Ukiryu::Definition::Source Abstract
- Inherits:
-
Object
- Object
- Ukiryu::Definition::Source
- Defined in:
- lib/ukiryu/definition/source.rb
Overview
Subclasses must implement #load, #cache_key, and #source_type
Abstract base class for definition sources
A source represents a location from which a tool definition can be loaded. Each source type (file, string, bundled, register) implements this interface.
Direct Known Subclasses
Ukiryu::Definition::Sources::FileSource, Ukiryu::Definition::Sources::StringSource
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Check if this source is equal to another.
-
#cache_key ⇒ String
abstract
Get a unique cache key for this source.
-
#hash ⇒ Integer
Generate hash code for hash storage.
-
#inspect ⇒ String
Inspect representation.
-
#load ⇒ String
abstract
Load the YAML definition content.
-
#source_type ⇒ Symbol
abstract
Get the source type identifier.
-
#to_s ⇒ String
String representation.
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Check if this source is equal to another
Two sources are equal if they have the same cache key.
47 48 49 50 51 |
# File 'lib/ukiryu/definition/source.rb', line 47 def ==(other) return false unless other.is_a?(Source) cache_key == other.cache_key end |
#cache_key ⇒ String
Get a unique cache key for this source
The cache key must uniquely identify both the source location and its content to ensure proper cache invalidation.
29 30 31 |
# File 'lib/ukiryu/definition/source.rb', line 29 def cache_key raise NotImplementedError, "#{self.class} must implement #cache_key" end |
#hash ⇒ Integer
Generate hash code for hash storage
57 58 59 |
# File 'lib/ukiryu/definition/source.rb', line 57 def hash cache_key.hash end |
#inspect ⇒ String
Inspect representation
71 72 73 |
# File 'lib/ukiryu/definition/source.rb', line 71 def inspect "#<#{self.class.name} source_type=#{source_type} cache_key=#{cache_key}>" end |
#load ⇒ String
Load the YAML definition content
18 19 20 |
# File 'lib/ukiryu/definition/source.rb', line 18 def load raise NotImplementedError, "#{self.class} must implement #load" end |
#source_type ⇒ Symbol
Get the source type identifier
37 38 39 |
# File 'lib/ukiryu/definition/source.rb', line 37 def source_type raise NotImplementedError, "#{self.class} must implement #source_type" end |
#to_s ⇒ String
String representation
64 65 66 |
# File 'lib/ukiryu/definition/source.rb', line 64 def to_s "#{source_type}:#{cache_key}" end |