Class: Opal::BuilderProcessors::JsProcessor

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

Defined Under Namespace

Classes: ManualFragment

Instance Attribute Summary

Attributes inherited from Processor

#autoloads, #filename, #options, #required_trees, #requires

Instance Method Summary collapse

Methods inherited from Processor

handles, #initialize, #mark_as_required, match?, match_regexp, #to_s

Constructor Details

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

Instance Method Details

#sourceObject



67
68
69
# File 'opal/lib/opal/builder_processors.rb', line 67

def source
  @source.to_s + mark_as_required(@filename)
end

#source_mapObject



55
56
57
58
59
60
61
62
63
64
65
# File 'opal/lib/opal/builder_processors.rb', line 55

def source_map
  @source_map ||= begin
    manual_fragments = source.each_line.with_index.map do |line_source, index|
      column = line_source.index(/\S/)
      line = index + 1
      ManualFragment.new(line, column, line_source, nil)
    end

    ::Opal::SourceMap::File.new(manual_fragments, filename, source)
  end
end