Module: Shells
- Defined in:
- lib/shells.rb,
lib/shells/errors.rb,
lib/shells/version.rb,
lib/shells/shell_base.rb,
lib/shells/bash_common.rb,
lib/shells/ssh_session.rb,
lib/shells/serial_session.rb,
lib/shells/pf_sense_common.rb,
lib/shells/pf_sense_ssh_session.rb,
lib/shells/pf_sense_serial_session.rb
Overview
A set of basic shell classes.
All shell sessions can be accessed by class name without calling new
.
Shells::SshSession(host: ...)
Shells::SerialSession(path: ...)
Shells::PfSenseSshSession(host: ...)
Shells::PfSenseSerialSession(path: ...)
Defined Under Namespace
Modules: BashCommon, PfSenseCommon Classes: CommandTimeout, FailedToSetPrompt, InvalidOption, NonZeroExitCode, PfSenseSerialSession, PfSenseSshSession, SerialSession, SessionCompleted, ShellBase, ShellError, SilenceTimeout, SshSession
Constant Summary collapse
- VERSION =
"0.1.12"
Class Method Summary collapse
-
.method_missing(m, *args, &block) ⇒ Object
Provides the ability for the Shells module to allow sessions to be instantiated without calling
new
.
Class Method Details
.method_missing(m, *args, &block) ⇒ Object
Provides the ability for the Shells module to allow sessions to be instantiated without calling new
.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/shells.rb', line 23 def self.method_missing(m, *args, &block) #:nodoc: is_const = if m.to_s =~ /^[A-Z][a-zA-Z0-9_]*$/ # must start with uppercase and contain only letters, numbers, and underscores. begin const_defined?(m) rescue NameError # if for some reason we still get a NameError, it's obviously not a constant. false end else false end if is_const val = const_get(m) if val.is_a?(Class) && Shells::ShellBase > val return val.new(*args, &block) end end super end |