Module: Unidom::Common::Concerns::ArgumentValidation::ClassMethods

Defined in:
app/models/unidom/common/concerns/argument_validation.rb

Instance Method Summary collapse

Instance Method Details

#assert_present!(name, value) ⇒ Object

断言给定的参数 value 非空。如果为空,则抛出 ArgumentError 异常。如: assert_present! :person, person

Raises:

  • (ArgumentError)


24
25
26
# File 'app/models/unidom/common/concerns/argument_validation.rb', line 24

def assert_present!(name, value)
  raise ArgumentError.new("The #{name} argument is required.") if value.blank?
end