Last active
May 28, 2020 14:57
-
-
Save b4ldr/a63a95399ef6b6afd1df620124f19195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
@@count = 1 | |
def self.count | |
@@count | |
end | |
def self.increment | |
@@count += 1 | |
end | |
end | |
Puppet::Functions.create_function(:'test::foo') do | |
dispatch :foo do | |
end | |
def foo | |
Foo.increment | |
Foo.count | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ puppet apply ~/puppet_tests/ruby_classvar.pp | |
Notice: Scope(Class[main]): 2 | |
Notice: Scope(Class[main]): 3 | |
Notice: Compiled catalog for work-laptop.home.arpa in environment production in 0.01 seconds | |
Notice: Applied catalog in 0.01 seconds | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
notice(test::foo()) | |
notice(test::foo()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment