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
 99 def initialize(path)
100   @path = path || EMPTY_ARRAY
101 end

Public Instance Methods

==(o) click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
115 def ==(o)
116   self.class == o.class && canonical_path == o.canonical_path
117 end
canonical_path() click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
103 def canonical_path
104   @canonical_path ||= @path.reject { |e| e.is_a?(VariantPathElement) }
105 end
chop_path(element_index) click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
127 def chop_path(element_index)
128   return self if element_index >= @path.size
129   chopped_path = @path.clone
130   chopped_path.delete_at(element_index)
131   copy = self.clone
132   copy.instance_variable_set(:@path, chopped_path)
133   copy
134 end
eql?(o) click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
119 def eql?(o)
120   self == o
121 end
format() click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
144 def format
145   p = @path
146   variant = ''
147   position = ''
148   unless p.empty?
149     f = p.first
150     if f.is_a?(SignaturePathElement)
151       variant = " #{f}"
152       p = p.drop(1)
153     end
154     position = " #{p.join(' ')}" unless p.empty?
155   end
156   message(variant, position)
157 end
hash() click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
123 def hash
124   canonical_path.hash
125 end
merge(path, o) click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
111 def merge(path, o)
112   self.class.new(path)
113 end
message(variant, position) click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
107 def message(variant, position)
108   "#{variant}unknown mismatch#{position}"
109 end
path_string() click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
136 def path_string
137   @path.join(' ')
138 end
to_s() click to toggle source
    # File lib/puppet/pops/types/type_mismatch_describer.rb
140 def to_s
141   format
142 end