Class: Tapioca::RBIFormatter

Inherits:
RBI::Formatter
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/tapioca/rbi_formatter.rb

Instance Method Summary collapse

Instance Method Details

#write_empty_body_comment!(file) ⇒ Object



24
25
26
27
28
# File 'lib/tapioca/rbi_formatter.rb', line 24

def write_empty_body_comment!(file)
  file.comments << RBI::BlankLine.new unless file.comments.empty?
  file.comments << RBI::Comment.new("THIS IS AN EMPTY RBI FILE.")
  file.comments << RBI::Comment.new("see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem")
end

#write_header!(file, command, reason: nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/tapioca/rbi_formatter.rb', line 15

def write_header!(file, command, reason: nil)
  file.comments << RBI::Comment.new("DO NOT EDIT MANUALLY")
  file.comments << RBI::Comment.new("This is an autogenerated file for #{reason}.") unless reason.nil?
  file.comments << RBI::Comment.new("Please instead update this file by running `#{command}`.")
  # Prevent the header from being attached to the top-level node when generating YARD docs
  file.comments << RBI::BlankLine.new
end