Sha256: ddcfe5462a400635d6c6347d43a7d65cb897ba6e02b25166a9903096e5bc05c7
Contents?: true
Size: 1.13 KB
Versions: 14
Compression:
Stored size: 1.13 KB
Contents
module Orthoses # Call `rbs prototype rb` and add to store # use Orthoses::RBSPrototypeRB, # paths: Dir.glob("lib/**/*.rb") class RBSPrototypeRB def initialize(loader, paths:, constant_filter: nil, mixin_filter: nil, attribute_filter: nil) @loader = loader @paths = paths @constant_filter = constant_filter @mixin_filter = mixin_filter @attribute_filter = attribute_filter end def call @loader.call.tap do |store| parser = RBS::Prototype::RB.new @paths.each do |path| begin Orthoses.logger.debug("parse #{path} by RBS::Prototype::RB") parser.parse File.read(path.to_s) rescue => err Orthoses.logger.error("Parse error #{err.inspect} by RBS::Prototype::RB #{path}") end end env = Orthoses::Content::Environment.new( constant_filter: @constant_filter, mixin_filter: @mixin_filter, attribute_filter: @attribute_filter, ) parser.decls.each do |decl| env << decl end env.write_to(store: store) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems