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

#abs_path, #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



69
70
71
# File 'opal/lib/opal/builder_processors.rb', line 69

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

#source_mapObject



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

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