Class: RSpec::Puppet::Sensitive

Inherits:
Puppet::Pops::Types::PSensitiveType::Sensitive
  • Object
show all
Defined in:
lib/rspec-puppet/sensitive.rb

Overview

A wrapper representing Sensitive data type, eg. in class params.

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Sensitive

Create a new Sensitive object

Parameters:

  • value (Object)

    to wrap



8
9
10
# File 'lib/rspec-puppet/sensitive.rb', line 8

def initialize(value)
  @value = value
end

Instance Method Details

#==(other) ⇒ Object

Parameters:

  • other (#unwrap, Object)

    value to compare to



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rspec-puppet/sensitive.rb', line 36

def ==(other)
  if other.respond_to? :unwrap
    if unwrap.is_a?(Regexp)
      unwrap =~ other.unwrap
    else
      unwrap == other.unwrap
    end
  else
    super
  end
end

#inspectObject

Returns inspect of the wrapped value, inside Sensitive().

Returns:

  • inspect of the wrapped value, inside Sensitive()



23
24
25
# File 'lib/rspec-puppet/sensitive.rb', line 23

def inspect
  "Sensitive(#{@value.inspect})"
end

#sensitive?Boolean

Returns true.

Returns:

  • (Boolean)

    true



18
19
20
# File 'lib/rspec-puppet/sensitive.rb', line 18

def sensitive?
  true
end

#to_sObject

Returns the unwrapped value (needed to show diff).

Returns:

  • the unwrapped value (needed to show diff)



28
29
30
# File 'lib/rspec-puppet/sensitive.rb', line 28

def to_s
  inspect
end

#unwrapObject

Returns the wrapped value.

Returns:

  • the wrapped value



13
14
15
# File 'lib/rspec-puppet/sensitive.rb', line 13

def unwrap
  @value
end