Class: Savory::Theme::Packager::Features
- Inherits:
-
Object
- Object
- Savory::Theme::Packager::Features
- Defined in:
- lib/savory/theme/packager/features.rb,
lib/savory/theme/packager/features/sass.rb,
lib/savory/theme/packager/features/compass.rb
Defined Under Namespace
Class Attribute Summary collapse
-
.feature_klasses ⇒ Object
readonly
Returns the value of attribute feature_klasses.
Class Method Summary collapse
Instance Method Summary collapse
- #apply!(theme, options = {}) ⇒ Object
- #clean(theme) ⇒ Object
-
#initialize(packager) ⇒ Features
constructor
A new instance of Features.
Constructor Details
#initialize(packager) ⇒ Features
Returns a new instance of Features.
13 14 15 16 17 18 |
# File 'lib/savory/theme/packager/features.rb', line 13 def initialize(packager) @packager = packager @features = self.class.feature_klasses.map do |klass| klass.new(packager) end end |
Class Attribute Details
.feature_klasses ⇒ Object (readonly)
Returns the value of attribute feature_klasses.
5 6 7 |
# File 'lib/savory/theme/packager/features.rb', line 5 def feature_klasses @feature_klasses end |
Class Method Details
.add_feature(klass) ⇒ Object
7 8 9 10 |
# File 'lib/savory/theme/packager/features.rb', line 7 def add_feature(klass) @feature_klasses ||= [] @feature_klasses << klass end |
Instance Method Details
#apply!(theme, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/savory/theme/packager/features.rb', line 20 def apply!(theme, = {}) applicable = @features.select do |f| f.enabled?(theme) end applicable.each do |f| f.apply(theme) end end |
#clean(theme) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/savory/theme/packager/features.rb', line 30 def clean(theme) applicable = @features.select do |f| f.enabled?(theme) end applicable.each do |f| f.clean(theme) end end |