Class: ObjectPresent

Inherits:
Object
  • Object
show all
Defined in:
lib/object_present.rb

Instance Method Summary collapse

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

Returns:

  • (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