module Opal

def self.append_path(path)

Opal.
here should only be paths which contain code targeted at being compiled by
has access to should add a load path through this method. Load paths added
Add a file path to opals load path. Any gem containing ruby code that Opal
def self.append_path(path)
  paths << path
end

def self.compile(source, options = {})

Returns:
  • (String) - javascript code

Parameters:
  • options (Hash) -- compiler options
  • source (String) -- ruby source

Other tags:
    See: Opal::Compiler.new - for compiler options
def self.compile(source, options = {})
  Compiler.new(source, options).compile
end

def self.core_dir

def self.core_dir
  File.expand_path('../../../opal', __FILE__.untaint)
end

def self.gem_dir

def self.gem_dir
  File.expand_path('../..', __FILE__.untaint)
end

def self.paths

Private, don't add to these directly (use .append_path instead).
def self.paths
  @paths ||= [core_dir.untaint, std_dir.untaint, gem_dir.untaint]
end

def self.process asset

Deprecated:
def self.process asset
  Environment.new[asset].to_s
end

def self.require_paths_for_gem(gem_name, include_dependencies)

def self.require_paths_for_gem(gem_name, include_dependencies)
  paths = []
  spec = Gem::Specification.find_by_name(gem_name)
  spec.runtime_dependencies.each do |dependency|
    paths += require_paths_for_gem(dependency.name, include_dependencies)
  end if include_dependencies
  gem_dir = spec.gem_dir
  spec.require_paths.map do |path|
    paths << File.join(gem_dir, path)
  end
  paths
end

def self.std_dir

def self.std_dir
  File.expand_path('../../../stdlib', __FILE__.untaint)
end

def self.use_gem(gem_name, include_dependencies = true)

def self.use_gem(gem_name, include_dependencies = true)
  require_paths_for_gem(gem_name, include_dependencies).each do |path|
    append_path path
  end
end