Class: Ukiryu::Models::OptionDefinition
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Ukiryu::Models::OptionDefinition
- Defined in:
- lib/ukiryu/models/option_definition.rb
Overview
Option definition for a command
Represents a named option (flag with value)
Instance Method Summary collapse
-
#[](key) ⇒ Object
Hash-like access for Type validation compatibility.
-
#applies_to?(platform) ⇒ Boolean
Check if option applies to a platform.
-
#assignment_delimiter_sym ⇒ Symbol
Get assignment delimiter as symbol.
-
#boolean? ⇒ Boolean
Check if type is boolean.
-
#name_sym ⇒ Symbol
Get name as symbol (cached for performance).
Instance Method Details
#[](key) ⇒ Object
Hash-like access for Type validation compatibility
75 76 77 78 79 80 81 |
# File 'lib/ukiryu/models/option_definition.rb', line 75 def [](key) key_sym = key.to_sym # Return nil for unknown keys (like Type validation options) return nil unless respond_to?(key_sym, true) send(key_sym) end |
#applies_to?(platform) ⇒ Boolean
Check if option applies to a platform
51 52 53 54 55 |
# File 'lib/ukiryu/models/option_definition.rb', line 51 def applies_to?(platform) return true if platforms.nil? || platforms.empty? cached_platforms_sym.include?(platform.to_sym) end |
#assignment_delimiter_sym ⇒ Symbol
Get assignment delimiter as symbol
67 68 69 |
# File 'lib/ukiryu/models/option_definition.rb', line 67 def assignment_delimiter_sym @assignment_delimiter_sym ||= assignment_delimiter.to_sym end |
#boolean? ⇒ Boolean
Check if type is boolean
60 61 62 |
# File 'lib/ukiryu/models/option_definition.rb', line 60 def boolean? type == 'boolean' end |
#name_sym ⇒ Symbol
Get name as symbol (cached for performance)
86 87 88 |
# File 'lib/ukiryu/models/option_definition.rb', line 86 def name_sym @name_sym ||= name.to_sym end |