Class: Gemvault::GemReference::Parser
- Inherits:
-
Object
- Object
- Gemvault::GemReference::Parser
- Defined in:
- lib/gemvault/gem_reference/parser.rb
Overview
Turns raw CLI input into the GemReference that selects it. Input is either
a bare name ("foo") or a combined NAME-VERSION ("foo-1.2.3"); an explicit
version overrides any version embedded in the input. A name and version
yield a SpecificVersion, a lone name an AnyVersion, and a non-exact version
a NonExactVersionError.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(input:, version: nil) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(input:, version: nil) ⇒ Parser
Returns a new instance of Parser.
12 |
# File 'lib/gemvault/gem_reference/parser.rb', line 12 def initialize(input:, version: nil) = super |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 |
# File 'lib/gemvault/gem_reference/parser.rb', line 14 def call boundary = version_boundary name = boundary ? input[0...boundary] : input = boundary && input[(boundary + 1)..] build(name:, version_string: version || ) end |