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


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

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


2
3
4
# File 'lib/puppet/datatypes/impl/error.rb', line 2

def details
  @details
end

#issue_codeObject (readonly)

Returns the value of attribute issue_code


2
3
4
# File 'lib/puppet/datatypes/impl/error.rb', line 2

def issue_code
  @issue_code
end

#kindObject (readonly)

Returns the value of attribute kind


2
3
4
# File 'lib/puppet/datatypes/impl/error.rb', line 2

def kind
  @kind
end

#msgObject (readonly) Also known as: message

Returns the value of attribute msg


2
3
4
# File 'lib/puppet/datatypes/impl/error.rb', line 2

def msg
  @msg
end

Class Method Details

.from_asserted_hash(hash) ⇒ Object


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

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

Instance Method Details

#_pcore_init_hashObject


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

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)

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

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

#hashObject


33
34
35
# File 'lib/puppet/datatypes/impl/error.rb', line 33

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

#to_sObject


37
38
39
# File 'lib/puppet/datatypes/impl/error.rb', line 37

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