module AWS::CloudFormation::StackOptions

def apply_template opts

def apply_template opts
  if template = opts.delete(:template)
    case template
    when String
      if template.match(/^http/)
        opts[:template_url] = template
      else
        opts[:template_body] = template
      end
    when URI then opts[:template_url] = template.to_s
    when S3::S3Object then opts[:template_body] = template.read
    else
      opts[:template_body] = template.to_json
    end
  end
end