class CreateGithubRelease::CommandLine::Options
@api public
options.errors #=> []
options.valid? #=> true
options.release_type = ‘major’
options = CreateGithubRelease::CommandLine::Options.new
@example
Stores and validates the command line options
def assert_no_unknown_options(options)
- Api: - private
Returns:
-
(void)
-
def assert_no_unknown_options(options) unknown_options = options.keys - ALLOWED_OPTIONS return if unknown_options.empty? message = "Unknown keywords: #{unknown_options.join(', ')}" raise ArgumentError, message end
def initialize(**options)
- Yieldreturn: - the return value is ignored
Other tags:
- Yieldparam: self - the instance being initialized
Other tags:
- Yield: - an initialization block
Other tags:
- Example: with a configuration block -
Example: With keyword arguments -
Example: No arguments or block given -
def initialize(**options) assert_no_unknown_options(options) options.each { |k, v| instance_variable_set("@#{k}", v) } self.quiet ||= false self.verbose ||= false self.pre ||= false @errors = [] yield(self) if block_given? @validator = CommandLine::Validator.new(self) valid? end