Class: Ukiryu::Models::VersionInfo
- Inherits:
-
Object
- Object
- Ukiryu::Models::VersionInfo
- Defined in:
- lib/ukiryu/models/version_info.rb
Overview
Version information with detection method tracking
Represents a version value with metadata about how it was detected. Supports multiple detection methods (command, man_page, etc.) as a fallback hierarchy, NOT mutually exclusive types.
Instance Attribute Summary collapse
-
#available_methods ⇒ Object
readonly
Returns the value of attribute available_methods.
-
#method_used ⇒ Object
readonly
Returns the value of attribute method_used.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Equality comparison.
-
#from_command? ⇒ Boolean
Check if version was detected via command.
-
#from_man_page? ⇒ Boolean
Check if version was detected via man page.
-
#from_profile? ⇒ Boolean
Check if version is from profile (hardcoded).
-
#initialize(value:, method_used:, available_methods: []) ⇒ VersionInfo
constructor
Initialize version info.
-
#inspect ⇒ String
Inspect representation.
-
#to_h ⇒ Hash
Hash representation.
-
#to_s ⇒ String
Display format with context Adds “(man page)” or “(profile)” suffix only for display, not stored in data.
Constructor Details
#initialize(value:, method_used:, available_methods: []) ⇒ VersionInfo
Initialize version info
32 33 34 35 36 |
# File 'lib/ukiryu/models/version_info.rb', line 32 def initialize(value:, method_used:, available_methods: []) @value = value @method_used = method_used @available_methods = available_methods end |
Instance Attribute Details
#available_methods ⇒ Object (readonly)
Returns the value of attribute available_methods.
25 26 27 |
# File 'lib/ukiryu/models/version_info.rb', line 25 def available_methods @available_methods end |
#method_used ⇒ Object (readonly)
Returns the value of attribute method_used.
25 26 27 |
# File 'lib/ukiryu/models/version_info.rb', line 25 def method_used @method_used end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
25 26 27 |
# File 'lib/ukiryu/models/version_info.rb', line 25 def value @value end |
Instance Method Details
#==(other) ⇒ Boolean
Equality comparison
91 92 93 94 95 96 97 |
# File 'lib/ukiryu/models/version_info.rb', line 91 def ==(other) return false unless other.is_a?(VersionInfo) value == other.value && method_used == other.method_used && available_methods == other.available_methods end |
#from_command? ⇒ Boolean
Check if version was detected via command
41 42 43 |
# File 'lib/ukiryu/models/version_info.rb', line 41 def from_command? method_used == :command end |
#from_man_page? ⇒ Boolean
Check if version was detected via man page
48 49 50 |
# File 'lib/ukiryu/models/version_info.rb', line 48 def from_man_page? method_used == :man_page end |
#from_profile? ⇒ Boolean
Check if version is from profile (hardcoded)
55 56 57 |
# File 'lib/ukiryu/models/version_info.rb', line 55 def from_profile? method_used == :profile end |
#inspect ⇒ String
Inspect representation
102 103 104 |
# File 'lib/ukiryu/models/version_info.rb', line 102 def inspect "#<VersionInfo value=\"#{value}\" method=#{method_used}>" end |
#to_h ⇒ Hash
Hash representation
79 80 81 82 83 84 85 |
# File 'lib/ukiryu/models/version_info.rb', line 79 def to_h { value: value, method: method_used, available_methods: available_methods } end |
#to_s ⇒ String
Display format with context Adds “(man page)” or “(profile)” suffix only for display, not stored in data
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ukiryu/models/version_info.rb', line 63 def to_s case method_used when :command value when :man_page "#{value} (man page)" when :profile value else value end end |