Sha256: 88eefc519eae2a9a954a1c086e2976abc4c00cb5b1324102132db4281d1014df
Contents?: true
Size: 892 Bytes
Versions: 24
Compression:
Stored size: 892 Bytes
Contents
#!/usr/bin/env ruby require 'bundler/setup' require 'hamlit' require 'lineprof' require 'tempfile' require 'thor' class CLI < Thor desc 'render HAML', 'Benchmark render' def render(file) haml = File.read(file) compiled = Hamlit::Engine.new.call(haml) code = [ 'require "lineprof"', 'require "hamlit"', 'Lineprof.profile(/./) do', '100.times do', compiled, 'end', 'end', ].join("\n") file = Tempfile.create('compiled') file.write(code) file.close system("bundle exec ruby #{file.path}") end desc 'compile HAML', 'Benchmark compile' def compile(file) haml = File.read(file) Lineprof.profile(/./) do 100.times { Hamlit::Engine.new.call(haml) } end end private def method_missing(*args) return super if args.length > 1 render(args.first.to_s) end end CLI.start
Version data entries
24 entries across 24 versions & 1 rubygems
Version | Path |
---|---|
hamlit-2.1.1 | bin/lineprof |
hamlit-2.1.0 | bin/lineprof |
hamlit-2.0.2 | bin/lineprof |
hamlit-2.0.1 | bin/lineprof |