def recipe_with_ruby_block(length)
      recipe = ""
      if length == :short || length == :both
        recipe << %q{
          ruby_block "subexpressions" do
	    block do
	      rc = Chef::Util::FileEdit.new("/foo/bar.conf")
              rc.search_file_replace_line(/^search/, "search #{node["foo"]["bar"]} compute-1.internal")
              rc.search_file_replace_line(/^domain/, "domain #{node["foo"]["bar"]}")
              rc.write_file
            end
            action :create
          end
        }
      end
      if length == :long || length == :both
        recipe << %q{
          ruby_block "too_long" do
            block do
              begin
                do_something('with argument')
                do_something_else('with another argument')
                foo = Foo.new('bar')
                foo.activate_turbo_boost
                foo.each do |thing|
                  case thing
                  when "fee"
                    puts 'Fee'
                  when "fi"
                    puts 'Fi'
                  when "fo"
                    puts 'Fo'
                  else
                    puts "Fum"
                  end
                end
              rescue Some::Exception
                Chef::Log.warn "Problem activating the turbo boost"
              end
            end
            action :create
          end
        }
      end
      write_recipe(recipe)
    end
def recipe_with_ruby_block(length)
      recipe = ""
      if length == :short || length == :both
        recipe << %q{
          ruby_block "subexpressions" do
	    block do
	      rc = Chef::Util::FileEdit.new("/foo/bar.conf")
              rc.search_file_replace_line(/^search/, "search #{node["foo"]["bar"]} compute-1.internal")
              rc.search_file_replace_line(/^domain/, "domain #{node["foo"]["bar"]}")
              rc.write_file
            end
            action :create
          end
        }
      end
      if length == :long || length == :both
        recipe << %q{
          ruby_block "too_long" do
            block do
              begin
                do_something('with argument')
                do_something_else('with another argument')
                foo = Foo.new('bar')
                foo.activate_turbo_boost
                foo.each do |thing|
                  case thing
                  when "fee"
                    puts 'Fee'
                  when "fi"
                    puts 'Fi'
                  when "fo"
                    puts 'Fo'
                  else
                    puts "Fum"
                  end
                end
              rescue Some::Exception
                Chef::Log.warn "Problem activating the turbo boost"
              end
            end
            action :create
          end
        }
      end
      write_recipe(recipe)
    end
Create a recipe with a ruby_block resource.

 @param [Symbol] length A :short or :long block, or :both