Sha256: 75667ee5cdbb9c47f0a4c330d57c1dcab373f4e4fed246e5416278b6324853d4
Contents?: true
Size: 883 Bytes
Versions: 4
Compression:
Stored size: 883 Bytes
Contents
# frozen_string_literal: true module Orthoses # Exclude RBS from output. # @example # use Orthoses::ExcludeRBS, paths: Dir['sig/hand-written/**/*.rbs'] class ExcludeRBS def initialize(loader, paths: nil, rbs: nil) raise ArgumentError, ':paths or :rbs keyword is required' if paths.nil? && rbs.nil? @loader = loader @paths = paths @rbs = rbs end def call case when @paths @paths.each do |path| add_signature_to_known_env(File.read(path.to_s)) end when @rbs add_signature_to_known_env(@rbs) else raise "bug" end @loader.call end def add_signature_to_known_env(rbs) buffer, directives, decls = ::RBS::Parser.parse_signature(rbs) Utils.rbs_environment.add_signature(buffer: buffer, directives: directives, decls: decls) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
orthoses-1.17.0 | lib/orthoses/exclude_rbs.rb |
orthoses-1.16.0 | lib/orthoses/exclude_rbs.rb |
orthoses-1.15.0 | lib/orthoses/exclude_rbs.rb |
orthoses-1.14.0 | lib/orthoses/exclude_rbs.rb |