Skip to content

Instantly share code, notes, and snippets.

@mattwildig
Created December 14, 2012 17:01
Show Gist options
  • Save mattwildig/4286958 to your computer and use it in GitHub Desktop.
Save mattwildig/4286958 to your computer and use it in GitHub Desktop.
A Haml :ruby filter that doesn't use locking and doesn't redirect $stdout.
:ruby_no_lock
puts 'This will go to wherever stdout is pointing'
haml_concat 'This will go into the Haml output'
# require this file after you've required Haml
module Haml::Filters
module RubyNoLock
include Base
def compile(compiler, text)
return if compiler.options[:suppress_eval]
compiler.instance_eval do
push_silent text
end
end
end
defined['ruby_no_lock'] = RubyNoLock
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment