Class: PuppetX::Puppetlabs::Migration::OverviewModel::Query::ScalarValue

Inherits:
RelationalStep
  • Object
show all
Defined in:
lib/puppet_x/puppetlabs/migration/overview_model/query.rb

Overview

Returns the first element of a collection

Instance Method Summary collapse

Instance Method Details

#evaluate(collection) ⇒ Entity?

Returns The entity or nil.

Parameters:

  • collection (Array<Entity>)

    The collection

Returns:

  • (Entity, nil)

    The entity or nil



20
21
22
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 20

def evaluate(collection)
  collection.is_a?(Array) ? collection.first : nil
end