Class: RBI::File

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/tapioca/rbi_ext/model.rb

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/tapioca/rbi_ext/model.rb', line 46

def empty?
  root.empty?
end

#set_empty_body_contentObject



39
40
41
42
43
# File 'lib/tapioca/rbi_ext/model.rb', line 39

def set_empty_body_content
  comments << RBI::BlankLine.new unless comments.empty?
  comments << RBI::Comment.new("THIS IS AN EMPTY RBI FILE.")
  comments << RBI::Comment.new("see https://github.com/Shopify/tapioca/wiki/Manual-Gem-Requires")
end

#set_file_header(command, reason: nil, display_heading: true) ⇒ Object



31
32
33
34
35
36
# File 'lib/tapioca/rbi_ext/model.rb', line 31

def set_file_header(command, reason: nil, display_heading: true)
  return unless display_heading
  comments << RBI::Comment.new("DO NOT EDIT MANUALLY")
  comments << RBI::Comment.new("This is an autogenerated file for #{reason}.") unless reason.nil?
  comments << RBI::Comment.new("Please instead update this file by running `#{command}`.")
end

#transform_rbi!Object



17
18
19
20
21
22
# File 'lib/tapioca/rbi_ext/model.rb', line 17

def transform_rbi!
  root.nest_singleton_methods!
  root.nest_non_public_methods!
  root.group_nodes!
  root.sort_nodes!
end

#transformed_stringObject



11
12
13
14
# File 'lib/tapioca/rbi_ext/model.rb', line 11

def transformed_string
  transform_rbi!
  string
end