Class: Puppet::DataTypes::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/datatypes/impl/error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, kind = nil, details = nil, issue_code = nil) ⇒ Error

Returns a new instance of Error.



19
20
21
22
23
24
# File 'lib/puppet/datatypes/impl/error.rb', line 19

def initialize(msg, kind = nil, details = nil, issue_code = nil)
  @msg = msg
  @kind = kind
  @details = details
  @issue_code = issue_code
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



4
5
6
# File 'lib/puppet/datatypes/impl/error.rb', line 4

def details
  @details
end

#issue_codeObject (readonly)

Returns the value of attribute issue_code.



4
5
6
# File 'lib/puppet/datatypes/impl/error.rb', line 4

def issue_code
  @issue_code
end

#kindObject (readonly)

Returns the value of attribute kind.



4
5
6
# File 'lib/puppet/datatypes/impl/error.rb', line 4

def kind
  @kind
end

#msgObject (readonly) Also known as: message

Returns the value of attribute msg.



4
5
6
# File 'lib/puppet/datatypes/impl/error.rb', line 4

def msg
  @msg
end

Class Method Details

.from_asserted_hash(hash) ⇒ Object



7
8
9
# File 'lib/puppet/datatypes/impl/error.rb', line 7

def self.from_asserted_hash(hash)
  new(hash['msg'], hash['kind'], hash['details'], hash['issue_code'])
end

Instance Method Details

#_pcore_init_hashObject



11
12
13
14
15
16
17
# File 'lib/puppet/datatypes/impl/error.rb', line 11

def _pcore_init_hash
  result = { 'msg' => @msg }
  result['kind'] = @kind unless @kind.nil?
  result['details'] = @details unless @details.nil?
  result['issue_code'] = @issue_code unless @issue_code.nil?
  result
end

#eql?(o) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


26
27
28
29
30
31
32
# File 'lib/puppet/datatypes/impl/error.rb', line 26

def eql?(o)
  self.class.equal?(o.class) &&
    @msg == o.msg &&
    @kind == o.kind &&
    @issue_code == o.issue_code &&
    @details == o.details
end

#hashObject



35
36
37
# File 'lib/puppet/datatypes/impl/error.rb', line 35

def hash
  @msg.hash ^ @kind.hash ^ @issue_code.hash
end

#to_sObject



39
40
41
# File 'lib/puppet/datatypes/impl/error.rb', line 39

def to_s
  Puppet::Pops::Types::StringConverter.singleton.convert(self)
end