module Erector::Externals::ClassMethods

Constants

INFERABLE_TYPES

Public Instance Methods

dependencies(type) click to toggle source

returns all dependencies of the given type from this class and all its superclasses

# File lib/erector/externals.rb, line 43
def dependencies(type)
  type = type.to_sym
  deps = Dependencies.new
  deps.push(*superclass.dependencies(type)) if superclass.respond_to?(:dependencies)
  deps.push(*my_dependencies.select { |x| x.type == type })
  deps.uniq
end
depends_on(*args) click to toggle source

Express a dependency of this widget Multiple forms:

depends_on(type, text, options = {})

for example

depends_on(:js, '/foo.js', :embed=>true)

Other variants:

depends_on(type, an_io, ... # file to be read
depends_on('blah.js' ... infer :js
depends_on('blah.css' ... infer :css
depends on :js, 'file1.js', 'file2.js'... [options]
depends_on :js => ["foo.js", "bar.js"], :css=>['file.css']
depends_on :js => ["foo.js", "bar.js"], other_option=>:blah
# File lib/erector/externals.rb, line 28
def depends_on(*args)
  x = interpret_args(*args)
  my_dependencies.push(x)
end
external(type, value, options = {}) click to toggle source

deprecated in favor of depends_on todo: warning

# File lib/erector/externals.rb, line 35
def external(type, value, options = {})
  type = type.to_sym
  x = Dependency.new(type, value, options)
  my_dependencies << x unless my_dependencies.include?(x)
end
my_dependencies() click to toggle source
# File lib/erector/externals.rb, line 51
def my_dependencies
  @my_dependencies ||= Dependencies.new
end