class Opal::BuilderProcessors::Processor
def handles(*extensions)
def handles(*extensions) @extensions = extensions matches = extensions.join('|') matches = "(#{matches})" unless extensions.size == 1 @match_regexp = Regexp.new "\\.#{matches}#{REGEXP_END}" ::Opal::Builder.register_processor(self, extensions) nil end
def initialize(source, filename, abs_path = nil, options = {})
def initialize(source, filename, abs_path = nil, options = {}) options = abs_path if abs_path.is_a? Hash source += "\n" unless source.end_with?("\n") @source, @filename, @abs_path, @options = source, filename, abs_path, options.dup @cache = @options.delete(:cache) { Opal.cache } @requires = [] @required_trees = [] @autoloads = [] end
def mark_as_required(filename)
def mark_as_required(filename) "Opal.loaded([#{filename.to_s.inspect}]);" end
def match?(other)
def match?(other) other.is_a?(String) && other.match(match_regexp) end
def match_regexp
def match_regexp @match_regexp || raise(NotImplementedError) end
def to_s
def to_s source.to_s end