Module: Mint::Style
- Defined in:
- lib/mint/style.rb
Constant Summary collapse
- CSS_EXTENSIONS =
["css"]
Class Method Summary collapse
-
.find_by_name(name) ⇒ Pathname
Returns the style file for the given template name.
-
.find_in_directory(directory) ⇒ Pathname
Finds the style file in a specific directory.
-
.valid?(pathname) ⇒ Boolean
Indicates whether the file is a valid stylesheet.
Class Method Details
.find_by_name(name) ⇒ Pathname
Returns the style file for the given template name
19 20 21 |
# File 'lib/mint/style.rb', line 19 def self.find_by_name(name) find_in_directory Template.find_directory_by_name(name) end |
.find_in_directory(directory) ⇒ Pathname
Finds the style file in a specific directory
27 28 29 |
# File 'lib/mint/style.rb', line 27 def self.find_in_directory(directory) directory&.children&.select(&:file?)&.select(&method(:valid?))&.first end |
.valid?(pathname) ⇒ Boolean
Indicates whether the file is a valid stylesheet
11 12 13 |
# File 'lib/mint/style.rb', line 11 def self.valid?(pathname) CSS_EXTENSIONS.map {|ext| "style.#{ext}" }.include? pathname.basename.to_s end |