Class: Parlour::Conversion::Converter

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/parlour/conversion/converter.rb

Overview

An abstract class which converts between the node trees of two type systems.

Direct Known Subclasses

RbiToRbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConverter

Returns a new instance of Converter.



13
14
15
# File 'lib/parlour/conversion/converter.rb', line 13

def initialize
  @warnings = []
end

Instance Attribute Details

#warningsObject (readonly)

Returns the value of attribute warnings.



18
19
20
# File 'lib/parlour/conversion/converter.rb', line 18

def warnings
  @warnings
end

Instance Method Details

#add_warning(msg, node) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/parlour/conversion/converter.rb', line 21

def add_warning(msg, node)
  warnings << [msg, node]

  return if $VERBOSE.nil?
  class_name = T.must(self.class.name).split('::').last
  print Rainbow("Parlour warning: ").yellow.dark.bold
  print Rainbow("#{class_name}: ").magenta.bright.bold
  puts msg
  print Rainbow("    └ at object: ").blue.bright.bold
  puts node.describe
end