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.1.2"
Class Method Summary collapse
-
.append_paths(*paths) ⇒ Object
(also: append_path)
Appends a path to the Plugin.
- .inherited(plugin) ⇒ Object
-
.paths ⇒ Object
All of the paths registered by the plugin.
-
.plugins ⇒ Object
Returns all of the plugins inheriting from Sprockets::Plugin.
-
.prepend_paths(*paths) ⇒ Object
(also: prepend_path)
Prepends a path to the 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 |
# File 'lib/sprockets/plugin.rb', line 32 def append_paths(*paths) self.paths.push *normalize_paths(paths) 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.
45 46 47 |
# File 'lib/sprockets/plugin.rb', line 45 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 |
.prepend_paths(*paths) ⇒ Object Also known as: prepend_path
Prepends a path to the Plugin. The path will later be appended to the Sprockets::Environment.
39 40 41 |
# File 'lib/sprockets/plugin.rb', line 39 def prepend_paths(*paths) self.paths.unshift *normalize_paths(paths) 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 |