Class: Dependabot::RustToolchain::ChannelParser
- Inherits:
-
Object
- Object
- Dependabot::RustToolchain::ChannelParser
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/rust_toolchain/channel_parser.rb
Instance Method Summary collapse
-
#initialize(toolchain) ⇒ ChannelParser
constructor
A new instance of ChannelParser.
- #parse ⇒ Object
Constructor Details
#initialize(toolchain) ⇒ ChannelParser
Returns a new instance of ChannelParser.
15 16 17 |
# File 'lib/dependabot/rust_toolchain/channel_parser.rb', line 15 def initialize(toolchain) @toolchain = toolchain end |
Instance Method Details
#parse ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/dependabot/rust_toolchain/channel_parser.rb', line 26 def parse case toolchain # Specific version like 1.72.0 or 1.72 when /^\d+\.\d+(\.\d+)?$/ Channel.new( stability: nil, date: nil, version: toolchain ) # With date: nightly-2025-01-0, beta-2025-01-0, stable-2025-01-0 when /^(nightly|beta|stable)-(\d{4}-\d{2}-\d{2})$/ Channel.new( stability: ::Regexp.last_match(1), date: ::Regexp.last_match(2), version: nil ) # Without date: stable, beta, nightly when STABLE_CHANNEL, BETA_CHANNEL, NIGHTLY_CHANNEL Channel.new( stability: toolchain, date: nil, version: nil ) end end |