class Puppet::Pops::Types::Mismatch
@api private
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 100 def initialize(path) 101 @path = path || EMPTY_ARRAY 102 end
Public Instance Methods
==(o)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 116 def ==(o) 117 self.class == o.class && canonical_path == o.canonical_path 118 end
canonical_path()
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 104 def canonical_path 105 @canonical_path ||= @path.reject { |e| e.is_a?(VariantPathElement) } 106 end
chop_path(element_index)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 128 def chop_path(element_index) 129 return self if element_index >= @path.size 130 chopped_path = @path.clone 131 chopped_path.delete_at(element_index) 132 copy = self.clone 133 copy.instance_variable_set(:@path, chopped_path) 134 copy 135 end
eql?(o)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 120 def eql?(o) 121 self == o 122 end
format()
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 145 def format 146 p = @path 147 variant = '' 148 position = '' 149 unless p.empty? 150 f = p.first 151 if f.is_a?(SignaturePathElement) 152 variant = " #{f}" 153 p = p.drop(1) 154 end 155 position = " #{p.join(' ')}" unless p.empty? 156 end 157 message(variant, position) 158 end
hash()
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 124 def hash 125 canonical_path.hash 126 end
merge(path, o)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 112 def merge(path, o) 113 self.class.new(path) 114 end
message(variant, position)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 108 def message(variant, position) 109 "#{variant}unknown mismatch#{position}" 110 end
path_string()
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 137 def path_string 138 @path.join(' ') 139 end
to_s()
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 141 def to_s 142 format 143 end