Method: Puppet::Pops::Types::TypeCalculator#infer
- Defined in:
- lib/puppet/pops/types/type_calculator.rb
#infer(o) ⇒ Object
Answers ‘what is the single common Puppet Type describing o’, or if o is an Array or Hash, what is the single common type of the elements (or keys and elements for a Hash).
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/puppet/pops/types/type_calculator.rb', line 255 def infer(o) # Optimize the most common cases into direct calls. # Explicit if/elsif/else is faster than case case o when String infer_String(o) when Integer # need subclasses for Ruby < 2.4 infer_Integer(o) when Array infer_Array(o) when Hash infer_Hash(o) when Evaluator::PuppetProc infer_PuppetProc(o) else @infer_visitor.visit_this_0(self, o) end end |