Class: Sprockets::Plugin
- Inherits:
-
Object
- Object
- Sprockets::Plugin
- Defined in:
- lib/sprockets/plugin.rb,
lib/sprockets/plugin/aware.rb,
lib/sprockets/plugin/version.rb
Defined Under Namespace
Modules: Aware
Constant Summary collapse
- VERSION =
'0.3.0'
Class Method Summary collapse
-
.append_paths(*paths) ⇒ Object
(also: append_path)
Appends a path to the Plugin.
-
.append_paths_in(path) ⇒ Object
Append each path in the given directory.
- .inherited(plugin) ⇒ Object
-
.paths ⇒ Object
All of the paths registered by the plugin.
-
.plugins ⇒ Object
Returns all of the plugins inheriting from Sprockets::Plugin.
-
.root(path = nil) ⇒ Object
Sets the root path or returns the current one.
Class Method Details
.append_paths(*paths) ⇒ Object Also known as: append_path
Appends a path to the Plugin. The path will later be appended to the Sprockets::Environment.
32 33 34 35 |
# File 'lib/sprockets/plugin.rb', line 32 def append_paths(*paths) self.paths.push *normalize_paths(paths) self end |
.append_paths_in(path) ⇒ Object
Append each path in the given directory.
39 40 41 42 43 |
# File 'lib/sprockets/plugin.rb', line 39 def append_paths_in(path) path = normalize_path(path) append_paths(*path.children.select(&:directory?)) if path.directory? self end |
.inherited(plugin) ⇒ Object
9 10 11 |
# File 'lib/sprockets/plugin.rb', line 9 def inherited(plugin) plugins << plugin end |
.paths ⇒ Object
All of the paths registered by the plugin.
46 47 48 |
# File 'lib/sprockets/plugin.rb', line 46 def paths @paths ||= [] end |
.plugins ⇒ Object
Returns all of the plugins inheriting from Sprockets::Plugin.
15 16 17 |
# File 'lib/sprockets/plugin.rb', line 15 def plugins @@plugins ||= [] end |
.root(path = nil) ⇒ Object
Sets the root path or returns the current one. A root path is required for appending relative paths.
22 23 24 25 26 27 28 |
# File 'lib/sprockets/plugin.rb', line 22 def root(path = nil) if path @root = Pathname.new(path). else @root end end |