Module: Mongoid::Extensions::Object::Checks
- Included in:
- Object
- Defined in:
- lib/mongoid/extensions/object/checks.rb
Overview
This module has object checks in it.
Instance Method Summary collapse
-
#_vacant? ⇒ true, false
Since Active Support’s blank? check looks to see if the object responds to #empty? and will call it if it does, we need another way to check if the object is empty or nil in case the user has defined a field called “empty” on the document.
Instance Method Details
#_vacant? ⇒ true, false
Since Active Support’s blank? check looks to see if the object responds to #empty? and will call it if it does, we need another way to check if the object is empty or nil in case the user has defined a field called “empty” on the document.
23 24 25 |
# File 'lib/mongoid/extensions/object/checks.rb', line 23 def _vacant? is_a?(::Array) || is_a?(::String) ? empty? : !self end |