Module: RubyGit::OptionValidators
Overview
Module containing option validators for RubyGit
Instance Method Summary collapse
-
#validate_boolean_option(name:, value:, nullable: false)
private
Raise an error if an option is not a Boolean (or optionally nil) value.
-
#validate_string_option(name:, value:, nullable: false)
private
Raise an error if an option is not a String (or optionally nil) value.
Instance Method Details
#validate_boolean_option(name:, value:, nullable: false)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Raise an error if an option is not a Boolean (or optionally nil) value
14 15 16 17 18 19 20 |
# File 'lib/ruby_git/option_validators.rb', line 14 def validate_boolean_option(name:, value:, nullable: false) return if nullable && value.nil? return if [true, false].include?(value) raise ArgumentError, "The '#{name}:' option must be a Boolean value but was #{value.inspect}" end |
#validate_string_option(name:, value:, nullable: false)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Raise an error if an option is not a String (or optionally nil) value
29 30 31 32 33 34 35 |
# File 'lib/ruby_git/option_validators.rb', line 29 def validate_string_option(name:, value:, nullable: false) return if nullable && value.nil? return if value.is_a?(String) raise ArgumentError, "The '#{name}:' option must be a String or nil but was #{value.inspect}" end |