# File lib/plugins/haml.rb, line 38 def editor(extname) unless cmd = ENV['VISUAL'] || ENV['EDITOR'] raise 'Please set VISUAL or EDITOR variable.' end # XXX: works only in Ruby 1.8.7 or later Tempfile.open(['tmp', ".#{extname}"]) do |f| system cmd, f.path return f.read end end
# File lib/plugins/haml.rb, line 31 def haml(format) return unless input = editor(:haml) opts = plugin_config.options.merge(format.empty? ? {} : {:format => format.to_sym}) ::Haml::Engine.new(input, opts).render.chomp end
Generated with the Darkfish Rdoc Generator 2.