From 905a76583eb03da254e717de9272c0e05e9d7a39 Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Sun, 31 Aug 2008 01:46:09 -0700 Subject: [PATCH] get rid of dslify_writer --- lib/sinatra.rb | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/lib/sinatra.rb b/lib/sinatra.rb index fdf426ad..98912acd 100755 --- a/lib/sinatra.rb +++ b/lib/sinatra.rb @@ -11,19 +11,6 @@ elsif ENV['EVENT'] puts "Using Evented Mongrel" end -class Class - def dslify_writer(*syms) - syms.each do |sym| - class_eval <<-end_eval - def #{sym}(v=nil) - self.send "#{sym}=", v if v - v - end - end_eval - end - end -end - module Rack #:nodoc: class Request #:nodoc: @@ -785,8 +772,6 @@ module Sinatra attr_accessor :request, :response - dslify_writer :status, :body - def initialize(request, response, route_params) @request = request @response = response @@ -794,6 +779,16 @@ module Sinatra @response.body = nil end + def status(value=nil) + response.status = value if value + response.status + end + + def body(value=nil) + response.body = value if value + response.body + end + def params @params ||= begin h = Hash.new {|h,k| h[k.to_s] if Symbol === k}