Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/alpha_card/object.rb
Overview
Object class needed to implement some nice active_support features for projects, that doesn’t need active_support.
Use-case: standalone Ruby scripts
Instance Method Summary collapse
Instance Method Details
#blank? ⇒ Boolean
7 8 9 |
# File 'lib/alpha_card/object.rb', line 7 def blank? respond_to?(:empty?) ? !!empty? : !self end |
#present? ⇒ Boolean
11 12 13 |
# File 'lib/alpha_card/object.rb', line 11 def present? !blank? end |
#try(*a, &b) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/alpha_card/object.rb', line 15 def try(*a, &b) if a.empty? && block_given? yield self else public_send(*a, &b) if respond_to?(a.first) end end |