Module: Arguard::Guards::CollectionsGuard
- Included in:
- Array
- Defined in:
- lib/arguard/guards/collections_guard.rb
Instance Method Summary collapse
Instance Method Details
#not_empty! ⇒ Object
13 14 15 16 17 |
# File 'lib/arguard/guards/collections_guard.rb', line 13 def not_empty! if self.size == 0 raise ArgumentError.new('Collection must not be empty.') end end |
#not_nil! ⇒ Object
6 7 8 9 10 11 |
# File 'lib/arguard/guards/collections_guard.rb', line 6 def not_nil! self.each do |item| item.not_nil! end self end |
#not_nil_not_empty! ⇒ Object
19 20 21 |
# File 'lib/arguard/guards/collections_guard.rb', line 19 def not_nil_not_empty! self.not_nil!.not_empty! end |