class Puppet::Pops::Types::PSensitiveType
A Puppet Language type that wraps sensitive information. The sensitive type is parameterized by the wrapped value type.
@api public
Constants
- DEFAULT
Public Class Methods
new(type = nil)
click to toggle source
# File lib/puppet/pops/types/p_sensitive_type.rb 44 def initialize(type = nil) 45 @type = type.nil? ? PAnyType.new : type.generalize 46 end
new_function(type)
click to toggle source
# File lib/puppet/pops/types/p_sensitive_type.rb 52 def self.new_function(type) 53 @new_function ||= Puppet::Functions.create_loaded_function(:new_Sensitive, type.loader) do 54 55 dispatch :from_sensitive do 56 param 'Sensitive', :value 57 end 58 59 dispatch :from_any do 60 param 'Any', :value 61 end 62 63 def from_any(value) 64 Sensitive.new(value) 65 end 66 67 # Since the Sensitive value is immutable we can reuse the existing instance instead of making a copy. 68 def from_sensitive(value) 69 value 70 end 71 end 72 end
register_ptype(loader, ir)
click to toggle source
# File lib/puppet/pops/types/p_sensitive_type.rb 40 def self.register_ptype(loader, ir) 41 create_ptype(loader, ir, 'AnyType') 42 end
Public Instance Methods
from_any(value)
click to toggle source
# File lib/puppet/pops/types/p_sensitive_type.rb 63 def from_any(value) 64 Sensitive.new(value) 65 end
from_sensitive(value)
click to toggle source
Since the Sensitive value is immutable we can reuse the existing instance instead of making a copy.
# File lib/puppet/pops/types/p_sensitive_type.rb 68 def from_sensitive(value) 69 value 70 end
instance?(o, guard = nil)
click to toggle source
# File lib/puppet/pops/types/p_sensitive_type.rb 48 def instance?(o, guard = nil) 49 o.is_a?(Sensitive) && @type.instance?(o.unwrap, guard) 50 end
Private Instance Methods
_assignable?(o, guard)
click to toggle source
# File lib/puppet/pops/types/p_sensitive_type.rb 76 def _assignable?(o, guard) 77 self.class == o.class && @type.assignable?(o.type, guard) 78 end