Class: ObjectPresent
- Inherits:
-
Object
- Object
- ObjectPresent
- Defined in:
- lib/object_present.rb
Instance Method Summary collapse
-
#initialize(object) ⇒ ObjectPresent
constructor
A new instance of ObjectPresent.
- #present? ⇒ Boolean
Constructor Details
#initialize(object) ⇒ ObjectPresent
Returns a new instance of ObjectPresent.
2 3 4 |
# File 'lib/object_present.rb', line 2 def initialize(object) @object = object end |
Instance Method Details
#present? ⇒ Boolean
6 7 8 9 10 11 12 |
# File 'lib/object_present.rb', line 6 def present? if @object.present? yield else nil end end |