Sha256: 4c22ecf8985bb678900bcd5dee0a1da8103638c6245d1237ce2ddb8e670c1670
Contents?: true
Size: 839 Bytes
Versions: 16
Compression:
Stored size: 839 Bytes
Contents
# encoding: utf-8 module GithubCLI class Command # Makes it easy to parse required and options arguments. class Arguments SEPARATOR = '/' attr_reader :args def initialize(args) @args = args end # Returns seperated arguments def parse required, non_required = nil, nil if !args.empty? required = args non_required, required = required.split('/', 2) if required.index('/') else raise RequiredArgumentMissingError, "No value provided for required argument" end [non_required, required] end # Returns a concise string representation of Arguments instance # def inspect "#<#{self.class.inspect} @args=#{args.inspect}" end end # Arguments end # Command end # GithubCLI
Version data entries
16 entries across 16 versions & 1 rubygems