Module: Ruby2JS::Filter

Included in:
Processor
Defined in:
lib/ruby2js.rb,
lib/ruby2js/filter.rb,
lib/ruby2js/filter/cjs.rb,
lib/ruby2js/filter/esm.rb,
lib/ruby2js/filter/vue.rb,
lib/ruby2js/filter/node.rb,
lib/ruby2js/filter/react.rb,
lib/ruby2js/filter/jquery.rb,
lib/ruby2js/filter/return.rb,
lib/ruby2js/filter/rubyjs.rb,
lib/ruby2js/filter/require.rb,
lib/ruby2js/filter/matchAll.rb,
lib/ruby2js/filter/nokogiri.rb,
lib/ruby2js/filter/camelCase.rb,
lib/ruby2js/filter/functions.rb,
lib/ruby2js/filter/wunderbar.rb,
lib/ruby2js/filter/underscore.rb,
lib/ruby2js/filter/minitest-jasmine.rb

Defined Under Namespace

Modules: CJS, CamelCase, ESM, Functions, JQuery, MatchAll, MiniTestJasmine, Node, Nokogiri, React, Require, Return, RubyJS, SEXP, Underscore, Vue, Wunderbar Classes: Processor

Constant Summary collapse

DEFAULTS =
[]
@@included =

module level defaults

nil
@@excluded =
[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exclude(*methods) ⇒ Object

indicate that the specified methods are not to be processed



17
18
19
20
21
22
23
# File 'lib/ruby2js/filter.rb', line 17

def self.exclude(*methods)
  if @@included
    @@included -= methods.flatten
  else
    @@excluded += methods.flatten
  end
end

.include(*methods) ⇒ Object

indicate that the specified methods are to be processed



37
38
39
40
41
42
43
# File 'lib/ruby2js/filter.rb', line 37

def self.include(*methods)
  if @@included
    @@included += methods.flatten
  else
    @@excluded -= methods.flatten
  end
end

.include_allObject

indicate that all methods are to be processed



26
27
28
29
# File 'lib/ruby2js/filter.rb', line 26

def self.include_all
  @@included = nil
  @@excluded = []
end

.include_only(*methods) ⇒ Object

indicate that only the specified methods are to be processed



32
33
34
# File 'lib/ruby2js/filter.rb', line 32

def self.include_only(*methods)
  @@included = methods.flatten
end

Instance Method Details

#exclude(*methods) ⇒ Object

indicate that the specified methods are not to be processed



80
81
82
83
84
85
86
# File 'lib/ruby2js/filter.rb', line 80

def exclude(*methods)
  if @included
    @included -= methods.flatten
  else
    @excluded += methods.flatten
  end
end

#excluded?(method) ⇒ Boolean

determine if a method is NOT to be processed



50
51
52
53
54
55
56
57
# File 'lib/ruby2js/filter.rb', line 50

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) ⇒ Object

indicate that the specified methods are to be processed



71
72
73
74
75
76
77
# File 'lib/ruby2js/filter.rb', line 71

def include(*methods)
  if @included
    @included += methods.flatten
  else
    @excluded -= methods.flatten
  end
end

#include_allObject

indicate that all methods are to be processed



60
61
62
63
# File 'lib/ruby2js/filter.rb', line 60

def include_all
  @included = nil
  @excluded = []
end

#include_only(*methods) ⇒ Object

indicate that only the specified methods are to be processed



66
67
68
# File 'lib/ruby2js/filter.rb', line 66

def include_only(*methods)
  @included = methods.flatten
end