Class: Puppet_X::Coi::Jboss::BuildinsUtils::BlankMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_x/coi/jboss/buildins_utils.rb

Overview

Matcher for blank objects (empty collections or false objects)

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ BlankMatcher

Constructor

Parameters:

  • target (Object)

    to be tested



20
21
22
# File 'lib/puppet_x/coi/jboss/buildins_utils.rb', line 20

def initialize(target)
  @target = target
end

Instance Method Details

#blank?Boolean

Method returns true if passed object is a hashlike object, but not String or Symbol

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/puppet_x/coi/jboss/buildins_utils.rb', line 24

def blank?
  return true if @target.nil?
  @target.respond_to?(:empty?) ? @target.empty? : !@target
end