Class: Opal::BuilderProcessors::RubyProcessor

Inherits:
Processor
  • Object
show all
Defined in:
opal/lib/opal/builder_processors.rb

Direct Known Subclasses

OpalERBProcessor

Instance Attribute Summary

Attributes inherited from Processor

#filename, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Processor

handles, #initialize, #mark_as_required, match_regexp, #to_s

Constructor Details

This class inherits a constructor from Opal::BuilderProcessors::Processor

Class Method Details

.match?(other) ⇒ Boolean

Also catch a files with missing extensions and nil.

Returns:

  • (Boolean)


112
113
114
# File 'opal/lib/opal/builder_processors.rb', line 112

def self.match?(other)
  super || File.extname(other.to_s) == ''
end

Instance Method Details

#autoloadsObject



107
108
109
# File 'opal/lib/opal/builder_processors.rb', line 107

def autoloads
  compiled.autoloads
end

#cache_keyObject



91
92
93
# File 'opal/lib/opal/builder_processors.rb', line 91

def cache_key
  [self.class, @filename, @source, @options]
end

#compiledObject



83
84
85
86
87
88
89
# File 'opal/lib/opal/builder_processors.rb', line 83

def compiled
  @compiled ||= Opal::Cache.fetch(@cache, cache_key) do
    compiler = compiler_for(@source, file: @filename)
    compiler.compile
    compiler
  end
end

#compiler_for(source, options = {}) ⇒ Object



95
96
97
# File 'opal/lib/opal/builder_processors.rb', line 95

def compiler_for(source, options = {})
  ::Opal::Compiler.new(source, @options.merge(options))
end

#required_treesObject



103
104
105
# File 'opal/lib/opal/builder_processors.rb', line 103

def required_trees
  compiled.required_trees
end

#requiresObject



99
100
101
# File 'opal/lib/opal/builder_processors.rb', line 99

def requires
  compiled.requires
end

#sourceObject



75
76
77
# File 'opal/lib/opal/builder_processors.rb', line 75

def source
  compiled.result
end

#source_mapObject



79
80
81
# File 'opal/lib/opal/builder_processors.rb', line 79

def source_map
  compiled.source_map
end