Class: TNS::Output::SASS
- Inherits:
-
Object
- Object
- TNS::Output::SASS
- Defined in:
- lib/tns/output/sass.rb
Overview
Output a given color as SASS variable.
Instance Method Summary collapse
- #format(palette) ⇒ Object
- #format_variant(variant) ⇒ Object
-
#initialize(name) ⇒ SASS
constructor
A new instance of SASS.
Constructor Details
#initialize(name) ⇒ SASS
Returns a new instance of SASS.
7 8 9 |
# File 'lib/tns/output/sass.rb', line 7 def initialize(name) @name = name end |
Instance Method Details
#format(palette) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/tns/output/sass.rb', line 11 def format(palette) palette .map { |variant| format_variant(variant) } .map { |string| "#{string};" } .join("\n") end |
#format_variant(variant) ⇒ Object
18 19 20 |
# File 'lib/tns/output/sass.rb', line 18 def format_variant(variant) "$#{@name}-#{variant.index * 100}: #{variant.to_css}" end |