Class: WinRM::Shells::ShellFactory
- Inherits:
-
Object
- Object
- WinRM::Shells::ShellFactory
- Defined in:
- lib/winrm/shells/shell_factory.rb
Overview
Factory for creating concrete shell instances
Instance Method Summary collapse
-
#create_shell(shell_type) ⇒ Object
Creates a new shell instance based off the shell_type.
-
#initialize(connection_opts, transport, logger) ⇒ ShellFactory
constructor
Creates a new ShellFactory instance.
Constructor Details
#initialize(connection_opts, transport, logger) ⇒ ShellFactory
Creates a new ShellFactory instance
29 30 31 32 33 |
# File 'lib/winrm/shells/shell_factory.rb', line 29 def initialize(connection_opts, transport, logger) @connection_opts = connection_opts @transport = transport @logger = logger end |
Instance Method Details
#create_shell(shell_type) ⇒ Object
Creates a new shell instance based off the shell_type
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/winrm/shells/shell_factory.rb', line 38 def create_shell(shell_type) type = shell_type.to_s.capitalize.to_sym if Shells.constants.include?(type) WinRM::Shells.const_get(type).new(@connection_opts, @transport, @logger) else = "#{type} is not a valid WinRM shell type. " \ 'Expected either :cmd, :powershell or pluggable shell.' raise WinRM::InvalidShellError, end end |