# File lib/hiera/filecache.rb, line 50 def read_file(path, expected_type = Object) if stale?(path) data = File.read(path, :encoding => 'BOM|UTF-8') @cache[path][:data] = block_given? ? yield(data) : data if !@cache[path][:data].is_a?(expected_type) raise TypeError, "Data retrieved from #{path} is #{@cache[path][:data].class} not #{expected_type}" end end @cache[path][:data] end