Module: Sass::Features
- Included in:
- Sass
- Defined in:
- lib/sass/features.rb
Overview
Provides Sass.has_feature?
which allows for simple feature detection
by providing a feature name.
Constant Summary collapse
- KNOWN_FEATURES =
This is the set of features that can be detected.
Set[*%w{ }]
Instance Method Summary collapse
-
#add_feature(feature_name)
Add a feature to Sass.
-
#has_feature?(feature_name) ⇒ Boolean
Check if a feature exists by name.
Instance Method Details
#add_feature(feature_name)
Add a feature to Sass. Plugins can use this to easily expose their availability to end users. Plugins must prefix their feature names with a dash to distinguish them from official features.
31 32 33 34 35 36 |
# File 'lib/sass/features.rb', line 31
def add_feature(feature_name)
unless feature_name[0] == ?-
raise ArgumentError.new("Plugin feature names must begin with a dash")
end
KNOWN_FEATURES << feature_name
end
|
#has_feature?(feature_name) ⇒ Boolean
Check if a feature exists by name. This is used to implement
the Sass function feature-exists($feature)
16 17 18 |
# File 'lib/sass/features.rb', line 16
def has_feature?(feature_name)
KNOWN_FEATURES.include?(feature_name)
end
|