Class: Parlour::Conversion::Converter
- Inherits:
-
Object
- Object
- Parlour::Conversion::Converter
- 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
Instance Attribute Summary collapse
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #add_warning(msg, node) ⇒ Object
-
#initialize ⇒ Converter
constructor
A new instance of Converter.
Constructor Details
#initialize ⇒ Converter
Returns a new instance of Converter.
13 14 15 |
# File 'lib/parlour/conversion/converter.rb', line 13 def initialize @warnings = [] end |
Instance Attribute Details
#warnings ⇒ Object (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 |