Class: SassRenderer
- Inherits:
-
Object
- Object
- SassRenderer
- Defined in:
- lib/gitstats/renderer/sass.rb
Instance Method Summary collapse
- #handle?(file) ⇒ Boolean
-
#initialize(templatedir, outdir, verbose) ⇒ SassRenderer
constructor
A new instance of SassRenderer.
- #name ⇒ Object
- #render(file, stats) ⇒ Object
Constructor Details
#initialize(templatedir, outdir, verbose) ⇒ SassRenderer
Returns a new instance of SassRenderer.
2 3 4 5 6 |
# File 'lib/gitstats/renderer/sass.rb', line 2 def initialize(templatedir, outdir, verbose) @templatedir = templatedir @outdir = outdir @verbose = verbose end |
Instance Method Details
#handle?(file) ⇒ Boolean
12 13 14 |
# File 'lib/gitstats/renderer/sass.rb', line 12 def handle?(file) (file =~ /\.sass$/) || (file =~ /\.scss$/) end |
#name ⇒ Object
8 9 10 |
# File 'lib/gitstats/renderer/sass.rb', line 8 def name 'sass/compass' end |
#render(file, stats) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gitstats/renderer/sass.rb', line 16 def render(file, stats) scss = file =~ /\.scss$/ ifile = File.join(@templatedir, file) ofile = File.join(@outdir, File.basename(file, scss ? '.scss' : '.sass') + '.css') lines = IO::readlines(ifile).join('') = Compass. [:syntax] = scss ? :scss : :sass engine = Sass::Engine.new(lines, ) lines = engine.render File.new(ofile, 'w').write(lines) end |