Class: Opal::BuilderProcessors::RubyProcessor
- Inherits:
-
Processor
- Object
- Processor
- Opal::BuilderProcessors::RubyProcessor
show all
- Defined in:
- opal/lib/opal/builder_processors.rb
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
Class Method Details
.match?(other) ⇒ Boolean
Also catch a files with missing extensions and nil.
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
#autoloads ⇒ Object
107
108
109
|
# File 'opal/lib/opal/builder_processors.rb', line 107
def autoloads
compiled.autoloads
end
|
#cache_key ⇒ Object
91
92
93
|
# File 'opal/lib/opal/builder_processors.rb', line 91
def cache_key
[self.class, @filename, @source, @options]
end
|
#compiled ⇒ Object
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_trees ⇒ Object
103
104
105
|
# File 'opal/lib/opal/builder_processors.rb', line 103
def required_trees
compiled.required_trees
end
|
#requires ⇒ Object
99
100
101
|
# File 'opal/lib/opal/builder_processors.rb', line 99
def requires
compiled.requires
end
|
#source ⇒ Object
75
76
77
|
# File 'opal/lib/opal/builder_processors.rb', line 75
def source
compiled.result
end
|
#source_map ⇒ Object
79
80
81
|
# File 'opal/lib/opal/builder_processors.rb', line 79
def source_map
compiled.source_map
end
|