Class: ATypes::EnumerableWrap

Inherits:
Wrapper show all
Defined in:
lib/a_types/decorators/enuemrable_wrap.rb

Overview

Adds enumerable convenience methods to any object, preserving its original behavior.

Instance Method Summary collapse

Methods inherited from Wrapper

#content

Instance Method Details

#blank?true, false

Checks whether the object is nil or empty.

Returns:

  • (true, false)

    if object is empty or nil.



16
17
18
19
20
21
22
# File 'lib/a_types/decorators/enuemrable_wrap.rb', line 16

def blank?
  if content.respond_to?(:empty?)
    content.empty?
  else
    content.nil?
  end
end

#filled?true, false

Returns true if this objects contains any actual content.

Returns:

  • (true, false)

    depending on whether this object has content.



8
9
10
# File 'lib/a_types/decorators/enuemrable_wrap.rb', line 8

def filled?
  !blank?
end