class Lap::Output
Public Class Methods
new(pathname)
click to toggle source
# File lib/lap.rb, line 27 def initialize(pathname) loader = RBS::EnvironmentLoader.new(core_root: nil) # don't pollute the env with ruby stdlib loader.add(path: Pathname(pathname)) @env = RBS::Environment.from_loader(loader).resolve_type_names end
Public Instance Methods
render()
click to toggle source
# File lib/lap.rb, line 33 def render output = @env.declarations.map do |decl| case decl when RBS::AST::Declarations::Class Lap::Class.new(decl).render when RBS::AST::Declarations::Module Lap::Module.new(decl).render else warn "TODO: #{decl} not implemented yet" nil end end puts FROZEN_STRING_COMMENT if Lap::Config[:frozen_string_literals] out = output.join("\n") puts out out end