class Rbs2ts::Converter::Declarations::Declarations

Public Class Methods

new(decls) click to toggle source
# File lib/rbs2ts/converter/declarations.rb, line 5
def initialize(decls)
  @decls = decls
end

Public Instance Methods

to_ts() click to toggle source
# File lib/rbs2ts/converter/declarations.rb, line 9
def to_ts
  decls_ts = @decls.map do |d|
    case d
    when ::RBS::AST::Declarations::Class then
      Converter::Declarations::Class.new(d).to_ts
    when ::RBS::AST::Declarations::Module then
      Converter::Declarations::Module.new(d).to_ts
    when ::RBS::AST::Declarations::Interface then
      Converter::Declarations::Interface.new(d).to_ts
    when ::RBS::AST::Declarations::Alias then
      Converter::Declarations::Alias.new(d).to_ts
    end
  end

  decls_ts.join("\n\n")
end