Rails等のプレームワークだとだいたい誰かがプラグインを作っていて、それが面倒を見てくれるので意識せずにHAMLを使えるが、今回は素のRubyスクリプトから使う場合。 Haml::Engineのrenderメソッド又はrender_procメソッドを使う。 render example.html.haml %p= hello 変数の内容をひとつ出力するだけのあまりにシンプルなテンプレートファイル。 haml_example.rb require 'haml' File.open("example.html.haml") do |f| Haml::Engine.new(f.read, :format => :xhtml).render(Object.new, :hello => "Hello World!!") end Haml::Engineのインスタンスを作ってrenderする。 Ha