Created
December 14, 2012 17:01
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:ruby_no_lock | |
puts 'This will go to wherever stdout is pointing' | |
haml_concat 'This will go into the Haml output' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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