Sha256: 8a36e418d7e0d74f0d13c1143e8b0a31ab210c882eee209ab2ead40ce10526f0

Contents?: true

Size: 631 Bytes

Versions: 7

Compression:

Stored size: 631 Bytes

Contents

module Ruby2JS
  class Converter

    # (import str const) 

    # NOTE: import is a synthetic 

    handle :import do |path, *args|
      put 'import '

      args.each_with_index do |arg, index|
        put ', ' unless index == 0
        parse arg
      end

      put ' from '
      put path.inspect
    end

    # (export const) 

    # NOTE: export is a synthetic 

    handle :export do |*args|
      put 'export '

      if args.first == :default
        put 'default '
        args.shift
      end

      args.each_with_index do |arg, index|
        put ', ' unless index == 0
        parse arg
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby2js-3.3.6 lib/ruby2js/converter/import.rb
ruby2js-3.3.5 lib/ruby2js/converter/import.rb
ruby2js-3.3.4 lib/ruby2js/converter/import.rb
ruby2js-3.3.3 lib/ruby2js/converter/import.rb
ruby2js-3.3.2 lib/ruby2js/converter/import.rb
ruby2js-3.3.1 lib/ruby2js/converter/import.rb
ruby2js-3.3.0 lib/ruby2js/converter/import.rb