Class: Opal::BuilderProcessors::RubyProcessor
Instance Attribute Summary
Attributes inherited from Processor
#filename, #options
Instance Method Summary
collapse
Methods inherited from Processor
extensions, handles, inherited, #initialize, #mark_as_required, match?, match_regexp, #to_s
Instance Method Details
88
89
90
91
92
93
94
|
# File 'opal/lib/opal/builder_processors.rb', line 88
def compiled
@compiled ||= begin
compiler = compiler_for(@source, file: @filename.gsub(/\.(rb|js|opal)#{REGEXP_END}/, ''))
compiler.compile
compiler
end
end
|
#compiler_class ⇒ Object
111
112
113
|
# File 'opal/lib/opal/builder_processors.rb', line 111
def compiler_class
::Opal::Compiler
end
|
#compiler_for(source, options = {}) ⇒ Object
96
97
98
|
# File 'opal/lib/opal/builder_processors.rb', line 96
def compiler_for(source, options = {})
compiler_class.new(source, @options.merge(options))
end
|
#required_trees ⇒ Object
104
105
106
107
108
109
|
# File 'opal/lib/opal/builder_processors.rb', line 104
def required_trees
compiled.required_trees.map do |tree|
File.join(File.dirname(@filename), tree).sub(%r{^(\./)*}, '')
end
end
|
100
101
102
|
# File 'opal/lib/opal/builder_processors.rb', line 100
def requires
compiled.requires
end
|
80
81
82
|
# File 'opal/lib/opal/builder_processors.rb', line 80
def source
compiled.result
end
|
#source_map ⇒ Object
84
85
86
|
# File 'opal/lib/opal/builder_processors.rb', line 84
def source_map
compiled.source_map.map
end
|