Class: Puppet_X::Coi::Jboss::BuildinsUtils::HashlikeMatcher

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

Overview

Matcher for hash-like objects

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ HashlikeMatcher

Constructor

Parameters:

  • target (Object)

    to be tested



7
8
9
# File 'lib/puppet_x/coi/jboss/buildins_utils.rb', line 7

def initialize(target)
  @target = target
end

Instance Method Details

#hashlike?Boolean

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

Returns:

  • (Boolean)


11
12
13
# File 'lib/puppet_x/coi/jboss/buildins_utils.rb', line 11

def hashlike?
  @target.respond_to? :[] and @target.respond_to? :each and not @target.is_a? String and not @target.is_a? Symbol
end