Class Module
In: lib/puppet/external/event-loop/better-definers.rb
Parent: Object

Methods

Public Instance methods

We don‘t need a singular alias for `define_accessors’, because it always defines at least two methods.

This method lets you define predicates like :foo?, which will be defined to return the value of @foo.

If you pass a predicate symbol :foo? to this method, it‘ll first define a regular writer method :foo, without a question mark. Then it‘ll define an imperative writer method :foo! as a shorthand for setting the property to true.

Guard each of the specified attributes by replacing the writer method with a proxy that asks the supplied block before proceeding with the change.

If it‘s okay to change the attribute, the block should return either nil or the symbol :mutable. If it isn‘t okay, the block should return a string saying why the attribute can‘t be changed. If you don‘t want to provide a reason, you can have the block return just the symbol :immutable.

[Validate]