Sha256: dc979218651c51d8dd029859d66664eb9b2067bf11a4b0d30f615edc313b9cdb
Contents?: true
Size: 562 Bytes
Versions: 3
Compression:
Stored size: 562 Bytes
Contents
# frozen_string_literal: true using ObjectExtensions using StringExtensions module FinAppsCore module Utils # Adds validation capabilities when included into other classes module Validatable def not_blank(value, name=nil) if nil_or_empty?(value) argument_name = name.nil? ? nil : ": #{name}" raise FinAppsCore::MissingArgumentsError.new "Missing argument#{argument_name}" end end def nil_or_empty?(value) !value || (value.respond_to?(:empty?) && value.empty?) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
finapps_core-2.0.20 | lib/finapps_core/utils/validatable.rb |
finapps_core-2.0.19 | lib/finapps_core/utils/validatable.rb |
finapps_core-2.0.18 | lib/finapps_core/utils/validatable.rb |