Skip to content

(MODULES-2561) add is_a function#523

Merged
bmjen merged 1 commit intopuppetlabs:masterfrom
DavidS:modules-2516-is_a
Sep 14, 2015
Merged

(MODULES-2561) add is_a function#523
bmjen merged 1 commit intopuppetlabs:masterfrom
DavidS:modules-2516-is_a

Conversation

@DavidS
Copy link
Copy Markdown
Contributor

@DavidS DavidS commented Sep 14, 2015

No description provided.

The data type system is very hard to understand. Many people don't
understand why

    type_of([1,2,3]) == Array

will fail, but

    type_of([1,2,3]) <= Array

passes. This does a simpler validation that doesn't rely on explicit
data types. Instead, use

    $foo = [1,2,3]
    if $foo.is_a(Array) {
      notify { 'This is an array': }
    }

This is based on code by Ben Ford <ben.ford@puppetlabs.com>.

  * Added acceptance tests
  * Added dispatch
  * Improved unit tests
  * Added docs to README
@bmjen
Copy link
Copy Markdown
Contributor

bmjen commented Sep 14, 2015

👍

bmjen added a commit that referenced this pull request Sep 14, 2015
(MODULES-2561) add is_a function
@bmjen bmjen merged commit 0ea0e40 into puppetlabs:master Sep 14, 2015
@DavidS DavidS deleted the modules-2516-is_a branch September 14, 2015 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants