Class: Opal::BuilderProcessors::RubyProcessor

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

Direct Known Subclasses

OpalERBProcessor

Instance Attribute Summary

Attributes inherited from Processor

#filename, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Processor

handles, #initialize, #mark_as_required, match_regexp, #to_s

Constructor Details

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

Class Method Details

.match?(other) ⇒ Boolean

Also catch a files with missing extensions and nil.

Returns:

  • (Boolean)


102
103
104
# File 'opal/lib/opal/builder_processors.rb', line 102

def self.match?(other)
  super || File.extname(other.to_s) == ''
end

Instance Method Details

#compiledObject



81
82
83
84
85
86
87
# File 'opal/lib/opal/builder_processors.rb', line 81

def compiled
  @compiled ||= begin
    compiler = compiler_for(@source, file: @filename)
    compiler.compile
    compiler
  end
end

#compiler_for(source, options = {}) ⇒ Object



89
90
91
# File 'opal/lib/opal/builder_processors.rb', line 89

def compiler_for(source, options = {})
  ::Opal::Compiler.new(source, @options.merge(options))
end

#required_treesObject



97
98
99
# File 'opal/lib/opal/builder_processors.rb', line 97

def required_trees
  compiled.required_trees
end

#requiresObject



93
94
95
# File 'opal/lib/opal/builder_processors.rb', line 93

def requires
  compiled.requires
end

#sourceObject



73
74
75
# File 'opal/lib/opal/builder_processors.rb', line 73

def source
  compiled.result
end

#source_mapObject



77
78
79
# File 'opal/lib/opal/builder_processors.rb', line 77

def source_map
  compiled.source_map
end