Class: Ukiryu::Models::ExecutionProfile
- Inherits:
-
Object
- Object
- Ukiryu::Models::ExecutionProfile
- Defined in:
- lib/ukiryu/models/implementation_version.rb
Overview
ExecutionProfile model for platform/shell-specific command configuration.
An ExecutionProfile defines how commands are formatted and executed for a specific platform and shell combination.
Instance Attribute Summary collapse
-
#actions ⇒ Hash
Command definitions.
-
#executable_name ⇒ String
Base executable name.
-
#name ⇒ Symbol
Profile identifier.
-
#option_style ⇒ Symbol
Option formatting style.
-
#platforms ⇒ Array<Symbol>
Supported platforms.
-
#shells ⇒ Array<Symbol>
Supported shells.
Instance Method Summary collapse
-
#command(action_name) ⇒ Hash?
Get command definition.
-
#commands ⇒ Hash
Get all command definitions.
-
#compatible?(platform, shell) ⇒ Boolean
Check if profile is compatible with platform and shell.
-
#initialize(name:, platforms:, shells:, option_style:, executable_name:, actions: {}) ⇒ ExecutionProfile
constructor
A new instance of ExecutionProfile.
-
#inspect ⇒ String
Inspect representation.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(name:, platforms:, shells:, option_style:, executable_name:, actions: {}) ⇒ ExecutionProfile
Returns a new instance of ExecutionProfile.
169 170 171 172 173 174 175 176 177 |
# File 'lib/ukiryu/models/implementation_version.rb', line 169 def initialize(name:, platforms:, shells:, option_style:, executable_name:, actions: {}) @name = name @platforms = Array(platforms).map(&:to_sym) @shells = Array(shells).map(&:to_sym) @option_style = option_style.to_sym @executable_name = executable_name @actions = actions.transform_keys(&:to_sym) freeze end |
Instance Attribute Details
#actions ⇒ Hash
Command definitions
160 161 162 |
# File 'lib/ukiryu/models/implementation_version.rb', line 160 def actions @actions end |
#executable_name ⇒ String
Base executable name
160 161 162 |
# File 'lib/ukiryu/models/implementation_version.rb', line 160 def executable_name @executable_name end |
#name ⇒ Symbol
Profile identifier
160 161 162 |
# File 'lib/ukiryu/models/implementation_version.rb', line 160 def name @name end |
#option_style ⇒ Symbol
Option formatting style
160 161 162 |
# File 'lib/ukiryu/models/implementation_version.rb', line 160 def option_style @option_style end |
#platforms ⇒ Array<Symbol>
Supported platforms
160 161 162 |
# File 'lib/ukiryu/models/implementation_version.rb', line 160 def platforms @platforms end |
#shells ⇒ Array<Symbol>
Supported shells
160 161 162 |
# File 'lib/ukiryu/models/implementation_version.rb', line 160 def shells @shells end |
Instance Method Details
#command(action_name) ⇒ Hash?
Get command definition
192 193 194 |
# File 'lib/ukiryu/models/implementation_version.rb', line 192 def command(action_name) @actions[action_name] end |
#commands ⇒ Hash
Get all command definitions
199 200 201 |
# File 'lib/ukiryu/models/implementation_version.rb', line 199 def commands @actions end |
#compatible?(platform, shell) ⇒ Boolean
Check if profile is compatible with platform and shell
184 185 186 |
# File 'lib/ukiryu/models/implementation_version.rb', line 184 def compatible?(platform, shell) @platforms.include?(platform) && @shells.include?(shell) end |
#inspect ⇒ String
Inspect representation
213 214 215 |
# File 'lib/ukiryu/models/implementation_version.rb', line 213 def inspect "#<Ukiryu::Models::ExecutionProfile #{@to_s}>" end |
#to_s ⇒ String
String representation
206 207 208 |
# File 'lib/ukiryu/models/implementation_version.rb', line 206 def to_s "#{@name} (#{@platforms.join(',')} / #{@shells.join(',')})" end |