Sha256: bd764b2f5243fa64821f28289838e67bc48cfb4ae440230df6288d32d4522a3c

Contents?: true

Size: 861 Bytes

Versions: 13

Compression:

Stored size: 861 Bytes

Contents

# typed: true
require 'rainbow'

module Parlour
  module Conversion
    # An abstract class which converts between the node trees of two type
    # systems.
    class Converter
      extend T::Sig
      extend T::Helpers
      abstract!

      def initialize
        @warnings = []
      end

      sig { returns(T::Array[[String, TypedObject]]) }
      attr_reader :warnings

      sig { params(msg: String, node: RbiGenerator::RbiObject).void }
      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
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
parlour-9.0.0 lib/parlour/conversion/converter.rb
parlour-8.1.0 lib/parlour/conversion/converter.rb
parlour-8.0.0 lib/parlour/conversion/converter.rb
parlour-7.0.0 lib/parlour/conversion/converter.rb
parlour-6.0.1 lib/parlour/conversion/converter.rb
parlour-6.0.0 lib/parlour/conversion/converter.rb
parlour-5.0.0 lib/parlour/conversion/converter.rb
parlour-5.0.0.beta.6 lib/parlour/conversion/converter.rb
parlour-5.0.0.beta.5 lib/parlour/conversion/converter.rb
parlour-5.0.0.beta.4 lib/parlour/conversion/converter.rb
parlour-5.0.0.beta.3 lib/parlour/conversion/converter.rb
parlour-5.0.0.beta.2 lib/parlour/conversion/converter.rb
parlour-5.0.0.beta.1 lib/parlour/conversion/converter.rb