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
extensions, handles, #initialize, #mark_as_required, match_regexp, #to_s
Class Method Details
.match?(other) ⇒ Boolean
Also catch a files with missing extensions and nil.
113
114
115
|
# File 'opal/lib/opal/builder_processors.rb', line 113
def self.match? other
super or File.extname(other.to_s) == ''
end
|
Instance Method Details
#compiled ⇒ Object
85
86
87
88
89
90
91
|
# File 'opal/lib/opal/builder_processors.rb', line 85
def compiled
@compiled ||= begin
compiler = compiler_for(@source, file: @filename.gsub(/\.(rb|js|opal)#{REGEXP_END}/, ''))
compiler.compile
compiler
end
end
|
#compiler_class ⇒ Object
108
109
110
|
# File 'opal/lib/opal/builder_processors.rb', line 108
def compiler_class
::Opal::Compiler
end
|
#compiler_for(source, options = {}) ⇒ Object
93
94
95
|
# File 'opal/lib/opal/builder_processors.rb', line 93
def compiler_for(source, options = {})
compiler_class.new(source, @options.merge(options))
end
|
#required_trees ⇒ Object
101
102
103
104
105
106
|
# File 'opal/lib/opal/builder_processors.rb', line 101
def required_trees
compiled.required_trees.map do |tree|
File.join(File.dirname(@filename), tree).sub(%r{^(\./)*}, '')
end
end
|
#requires ⇒ Object
97
98
99
|
# File 'opal/lib/opal/builder_processors.rb', line 97
def requires
compiled.requires
end
|
#source ⇒ Object
77
78
79
|
# File 'opal/lib/opal/builder_processors.rb', line 77
def source
compiled.result
end
|
#source_map ⇒ Object
81
82
83
|
# File 'opal/lib/opal/builder_processors.rb', line 81
def source_map
compiled.source_map.map
end
|