module Ruby2JS::Filter

Constants

DEFAULTS

Public Class Methods

exclude(*methods) click to toggle source

indicate that the specified methods are not to be processed

# File lib/ruby2js/filter.rb, line 25
def self.exclude(*methods)
  if @@included
    @@included -= methods.flatten
  else
    @@excluded += methods.flatten
  end
end
excluded_methods() click to toggle source
# File lib/ruby2js/filter.rb, line 20
def self.excluded_methods
  @@excluded&.dup
end
include(*methods) click to toggle source

indicate that the specified methods are to be processed

# File lib/ruby2js/filter.rb, line 45
def self.include(*methods)
  if @@included
    @@included += methods.flatten
  else
    @@excluded -= methods.flatten
  end
end
include_all() click to toggle source

indicate that all methods are to be processed

# File lib/ruby2js/filter.rb, line 34
def self.include_all
  @@included = nil
  @@excluded = []
end
include_only(*methods) click to toggle source

indicate that only the specified methods are to be processed

# File lib/ruby2js/filter.rb, line 40
def self.include_only(*methods)
  @@included = methods.flatten
end
included_methods() click to toggle source
# File lib/ruby2js/filter.rb, line 16
def self.included_methods
  @@included&.dup
end

Public Instance Methods

exclude(*methods) click to toggle source

indicate that the specified methods are not to be processed

# File lib/ruby2js/filter.rb, line 88
def exclude(*methods)
  if @included
    @included -= methods.flatten
  else
    @excluded += methods.flatten
  end
end
excluded?(method) click to toggle source

determine if a method is NOT to be processed

# File lib/ruby2js/filter.rb, line 58
def excluded?(method)
  if @included
    not @included.include? method
  else
    return true if @exclude_methods.flatten.include? method
    @excluded&.include? method
  end
end
include(*methods) click to toggle source

indicate that the specified methods are to be processed

# File lib/ruby2js/filter.rb, line 79
def include(*methods)
  if @included
    @included += methods.flatten
  else
    @excluded -= methods.flatten
  end
end
include_all() click to toggle source

indicate that all methods are to be processed

# File lib/ruby2js/filter.rb, line 68
def include_all
  @included = nil
  @excluded = []
end
include_only(*methods) click to toggle source

indicate that only the specified methods are to be processed

# File lib/ruby2js/filter.rb, line 74
def include_only(*methods)
  @included = methods.flatten
end

Private Instance Methods

find_autoimport(token) click to toggle source
# File lib/ruby2js/filter/esm.rb, line 192
def find_autoimport(token)
  return nil if @esm_autoimports.nil?
  return nil if @esm_explicit_tokens.include?(token)

  token = camelCase(token) if respond_to?(:camelCase)

  if @esm_autoimports[token]
    [@esm_autoimports[token], s(:const, nil, token)]
  elsif found_key = @esm_autoimports.keys.find {|key| key.is_a?(Array) && key.include?(token)}
    [@esm_autoimports[found_key], found_key.map {|key| s(:const, nil, key)}]
  end
end