#!/usr/bin/env ruby def when_logging yield if $do_logging end $do_logging = false when_logging { puts "Never Printed" } $do_logging = true when_logging { puts "Always Printed" }