Class: Opal::BuilderProcessors::RubyProcessor

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

Direct Known Subclasses

OpalERBProcessor

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

Constructor Details

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

Instance Method Details

#compiled ⇒ Object



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)
    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



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
# File 'opal/lib/opal/builder_processors.rb', line 104

def required_trees
  compiled.required_trees
end

#requires ⇒ Object



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

def requires
  compiled.requires
end

#source ⇒ Object



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