Class: DataMaps::When::Empty

Inherits:
Base show all
Defined in:
lib/data_maps/when/empty.rb

Overview

Condition to check for empty data

Since:

  • 0.0.1

Instance Attribute Summary

Attributes inherited from Executable

#@option, #option

Instance Method Summary collapse

Methods inherited from Executable

#initialize, valid_collection?

Constructor Details

This class inherits a constructor from DataMaps::Executable

Instance Method Details

#execute(data) ⇒ Object

Check if data is empty? and return true if this equals the option

Parameters:

  • data (mixed)

Since:

  • 0.0.1



10
11
12
13
# File 'lib/data_maps/when/empty.rb', line 10

def execute(data)
  return option unless data.present?
  data.empty? == option
end