Module: Abstract::Extensions::Object
- Defined in:
- lib/abstracts.rb
Overview
Object extensions
Instance Method Summary collapse
-
#blank? ⇒ Trueclass, FalseClass
Check if object is blank.
-
#default_hash ⇒ Hash
Add default proc to Hash.
Instance Method Details
#blank? ⇒ Trueclass, FalseClass
Check if object is blank
9 10 11 |
# File 'lib/abstracts.rb', line 9 def blank? respond_to?(:empty?) && empty? || !self end |
#default_hash ⇒ Hash
Add default proc to Hash
15 16 17 18 19 |
# File 'lib/abstracts.rb', line 15 def default_hash Hash.new do |hash, key| hash[key] = Hash.new(&hash.default_proc) end end |