Module: Erector::Externals::ClassMethods
- Defined in:
- lib/erector/externals.rb
Instance Method Summary collapse
-
#dependencies(type) ⇒ Object
returns all dependencies of the given type from this class and all its superclasses.
-
#depends_on(*args) ⇒ Object
Express a dependency of this widget Multiple forms: depends_on(type, text, options = {}) for example depends_on(:js, ‘/foo.js’, :embed=>true).
- #my_dependencies ⇒ Object
Instance Method Details
#dependencies(type) ⇒ Object
returns all dependencies of the given type from this class and all its superclasses
35 36 37 38 39 40 41 |
# File 'lib/erector/externals.rb', line 35 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) ⇒ Object
Express a dependency of this widget Multiple forms:
depends_on(type, text, = {})
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
28 29 30 31 |
# File 'lib/erector/externals.rb', line 28 def depends_on(*args) x = interpret_args(*args) my_dependencies.push(x) end |
#my_dependencies ⇒ Object
43 44 45 |
# File 'lib/erector/externals.rb', line 43 def my_dependencies @my_dependencies ||= Dependencies.new end |