Class: Ukiryu::Models::ArgumentDefinition
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Ukiryu::Models::ArgumentDefinition
- Defined in:
- lib/ukiryu/models/argument_definition.rb
Overview
Argument definition for a command
Instance Method Summary collapse
-
#[](key) ⇒ Object
Hash-like access for Type validation compatibility.
-
#last? ⇒ Boolean
Check if this is the last argument.
-
#name_sym ⇒ Symbol
Get name as symbol (cached for performance).
-
#numeric_position ⇒ Integer
Get numeric position for sorting.
-
#parsed_position ⇒ Symbol, Integer
Get the position as symbol or integer.
-
#type_sym ⇒ Symbol
Get type as symbol (cached for performance).
Instance Method Details
#[](key) ⇒ Object
Hash-like access for Type validation compatibility
94 95 96 97 98 99 100 |
# File 'lib/ukiryu/models/argument_definition.rb', line 94 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 |
#last? ⇒ Boolean
Check if this is the last argument
54 55 56 |
# File 'lib/ukiryu/models/argument_definition.rb', line 54 def last? position == 'last' end |
#name_sym ⇒ Symbol
Get name as symbol (cached for performance)
105 106 107 |
# File 'lib/ukiryu/models/argument_definition.rb', line 105 def name_sym @name_sym ||= name.to_sym end |
#numeric_position ⇒ Integer
Get numeric position for sorting
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/ukiryu/models/argument_definition.rb', line 77 def numeric_position case position when 'last' 999 when 'first' 1 when /^\d+$/ position.to_i else 99 end end |
#parsed_position ⇒ Symbol, Integer
Get the position as symbol or integer
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ukiryu/models/argument_definition.rb', line 61 def parsed_position case position when 'last' :last when 'first' :first when /^\d+$/ position.to_i else 99 end end |
#type_sym ⇒ Symbol
Get type as symbol (cached for performance)
112 113 114 |
# File 'lib/ukiryu/models/argument_definition.rb', line 112 def type_sym @type_sym ||= type.to_sym end |