Class: MarhanCli::Constraint

Inherits:
Object
  • Object
show all
Defined in:
lib/marhan_cli/helper/constraint.rb

Class Method Summary collapse

Class Method Details

.not_nil!(argument, argument_name) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
# File 'lib/marhan_cli/helper/constraint.rb', line 4

def self.not_nil!(argument, argument_name)
  raise ArgumentError, "Given argument '#{argument_name}' must not be nil" if argument.nil?
end

.not_nil_or_empty!(argument, message) ⇒ Object



8
9
10
11
12
# File 'lib/marhan_cli/helper/constraint.rb', line 8

def self.not_nil_or_empty!(argument, message)
  if argument.nil? or argument.empty?
    raise ArgumentError, message
  end
end