Method: Puppet::Property.newvalue
- Defined in:
- lib/puppet/property.rb
.newvalue(name, options = {}, &block) ⇒ Object
TODO:
Option :event original comment says “event should be returned…”, is “returned” the correct word to use?
Defines a new valid value for this property. A valid value is specified as a literal (typically a Symbol), but can also be specified with a Regexp.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/puppet/property.rb', line 165 def self.newvalue(name, = {}, &block) value = value_collection.newvalue(name, , &block) unless value.method.nil? method = value.method.to_sym if value.block if instance_methods(false).include?(method) raise ArgumentError, _("Attempt to redefine method %{method} with block") % { method: method } end define_method(method, &value.block) else # Let the method be an alias for calling the providers setter unless we already have this method alias_method(method, :call_provider) unless method_defined?(method) end end value end |