Class: Ruby::Nginx::Commands::NginxVersion
- Inherits:
-
TerminalCommand
- Object
- TerminalCommand
- Ruby::Nginx::Commands::NginxVersion
- Defined in:
- lib/ruby/nginx/commands/nginx_version.rb
Instance Attribute Summary
Attributes inherited from TerminalCommand
#cmd, #error_type, #printer, #result, #user
Instance Method Summary collapse
-
#initialize ⇒ NginxVersion
constructor
A new instance of NginxVersion.
- #run ⇒ Object
Methods included from Helpers::SudoHelper
Methods included from Helpers::PromptHelper
Constructor Details
#initialize ⇒ NginxVersion
Returns a new instance of NginxVersion.
9 10 11 |
# File 'lib/ruby/nginx/commands/nginx_version.rb', line 9 def initialize super(cmd: "nginx -v", raise: Ruby::Nginx::Error) end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ruby/nginx/commands/nginx_version.rb', line 13 def run super # nginx -v outputs to stderr Ruby::Nginx::Version.new(result.stderr.match(/\d+\.\d+\.?\d?/).to_s) end |