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

#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



65
66
67
# File 'opal/lib/opal/builder_processors.rb', line 65

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

#source_mapObject



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

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