Module: FinAppsCore::Utils::Validatable
- Included in:
- REST::BaseClient, REST::Resources
- Defined in:
- lib/finapps_core/utils/validatable.rb
Overview
Adds validation capabilities when included into other classes
Instance Method Summary collapse
Instance Method Details
#nil_or_empty?(value) ⇒ Boolean
14 15 16 |
# File 'lib/finapps_core/utils/validatable.rb', line 14 def nil_or_empty?(value) !value || (value.respond_to?(:empty?) && value.empty?) end |
#not_blank(value, name = nil) ⇒ Object
10 11 12 |
# File 'lib/finapps_core/utils/validatable.rb', line 10 def not_blank(value, name = nil) fail FinAppsCore::MissingArgumentsError, name.nil? ? nil : ": #{name}" if nil_or_empty?(value) end |