Sha256: a15eb1596e105b03d8797c60fe98eb05cde816a0c30c471b5847299b5f52c7ba
Contents?: true
Size: 501 Bytes
Versions: 2
Compression:
Stored size: 501 Bytes
Contents
module Mpx ## # Extracts `<SUBCOMMAND/ALIAS>:<ARG> <ARGS>`. class Request def initialize(args) directive, *rest = args if !directive&.include? ':' raise 'missing directive' end cmd, first_arg = directive.split ':', 2 if first_arg.empty? raise 'missing first arg' end @name = cmd.empty? ? nil : cmd @args = [first_arg, *rest] end def name return @name end def args return @args end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mpx-0.1.1 | lib/mpx/request.rb |
mpx-0.1.0 | lib/mpx/request.rb |