Class: Puppet::Pops::Types::Mismatch Private
- Defined in:
- lib/puppet/pops/types/type_mismatch_describer.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
ExpectedActualMismatch, KeyMismatch, MissingRequiredBlock, UnexpectedBlock, UnresolvedTypeReference
Instance Attribute Summary collapse
- #path ⇒ Object readonly private
Instance Method Summary collapse
- #==(o) ⇒ Object private
- #canonical_path ⇒ Object private
- #chop_path(element_index) ⇒ Object private
- #eql?(o) ⇒ Boolean private
- #format ⇒ Object private
- #hash ⇒ Object private
-
#initialize(path) ⇒ Mismatch
constructor
private
A new instance of Mismatch.
- #merge(path, o) ⇒ Object private
- #message(variant, position) ⇒ Object private
- #path_string ⇒ Object private
- #to_s ⇒ Object private
Constructor Details
#initialize(path) ⇒ Mismatch
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Mismatch.
101 102 103 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 101 def initialize(path) @path = path || EMPTY_ARRAY end |
Instance Attribute Details
#path ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
99 100 101 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 99 def path @path end |
Instance Method Details
#==(o) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
117 118 119 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 117 def ==(o) self.class == o.class && canonical_path == o.canonical_path end |
#canonical_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
105 106 107 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 105 def canonical_path @canonical_path ||= @path.reject { |e| e.is_a?(VariantPathElement) } end |
#chop_path(element_index) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
129 130 131 132 133 134 135 136 137 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 129 def chop_path(element_index) return self if element_index >= @path.size chopped_path = @path.clone chopped_path.delete_at(element_index) copy = clone copy.instance_variable_set(:@path, chopped_path) copy end |
#eql?(o) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
121 122 123 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 121 def eql?(o) self == o end |
#format ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 147 def format p = @path variant = '' position = '' unless p.empty? f = p.first if f.is_a?(SignaturePathElement) variant = " #{f}" p = p.drop(1) end position = " #{p.join(' ')}" unless p.empty? end (variant, position) end |
#hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
125 126 127 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 125 def hash canonical_path.hash end |
#merge(path, o) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
113 114 115 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 113 def merge(path, o) self.class.new(path) end |
#message(variant, position) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
109 110 111 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 109 def (variant, position) "#{variant}unknown mismatch#{position}" end |
#path_string ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
139 140 141 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 139 def path_string @path.join(' ') end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
143 144 145 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 143 def to_s format end |