Class: Derelict::Parser::Version
- Inherits:
-
Derelict::Parser
- Object
- Derelict::Parser
- Derelict::Parser::Version
- Extended by:
- Memoist
- Defined in:
- lib/derelict/parser/version.rb,
lib/derelict/parser/version/invalid_format.rb
Overview
Parses the output of “vagrant –version”
Defined Under Namespace
Classes: InvalidFormat
Constant Summary collapse
- PARSE_VERSION_FROM_OUTPUT =
Regexp to extract the version from the “vagrant –version” output
/^Vagrant (?:v(?:ersion )?)?(.*)?$/
Instance Attribute Summary
Attributes inherited from Derelict::Parser
Instance Method Summary collapse
-
#description ⇒ Object
Provides a description of this Parser.
-
#version ⇒ Object
Determines the version of Vagrant based on the output.
Methods inherited from Derelict::Parser
Methods included from Utils::Logger
Constructor Details
This class inherits a constructor from Derelict::Parser
Instance Method Details
#description ⇒ Object
Provides a description of this Parser
Mainly used for log messages.
24 25 26 |
# File 'lib/derelict/parser/version.rb', line 24 def description "Derelict::Parser::Version instance" end |
#version ⇒ Object
Determines the version of Vagrant based on the output
13 14 15 16 17 18 |
# File 'lib/derelict/parser/version.rb', line 13 def version logger.debug "Parsing version from output using #{description}" matches = output.match PARSE_VERSION_FROM_OUTPUT raise InvalidFormat.new output if matches.nil? matches.captures[0] end |