module YARD::Templates::Template

def file(basename, allow_inherited = false)

Other tags:
    See: ClassMethods#find_nth_file -
    See: ClassMethods#find_file -

Returns:
  • (String) - the contents of a file identified by +basename+. All

Parameters:
  • allow_inherited (Boolean) -- whether inherited templates can
  • basename (String) -- the name of the file
def file(basename, allow_inherited = false)
  file = self.class.find_file(basename)
  raise ArgumentError, "no file for '#{basename}' in #{self.class.path}" unless file
  data = IO.read(file)
  if allow_inherited
    superfile = self.class.find_nth_file(basename, 2)
    data.gsub!('{{{__super__}}}', superfile ? IO.read(superfile) : "")
  end
  data
end