Module: Todo::Helpers::Object::Presence
Instance Method Summary collapse
Instance Method Details
#blank?(obj) ⇒ Boolean
18 19 20 |
# File 'lib/todo/helpers/object/presence.rb', line 18 def blank?(obj) not present?(obj) end |
#present?(obj) ⇒ Boolean
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/todo/helpers/object/presence.rb', line 5 def present?(obj) case obj when NilClass, FalseClass false when TrueClass, Symbol, Numeric true when ::String, ::Array, ::Hash !obj.empty? else fail "Unexpected object type #{obj.inspect}" end end |