mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
get rid of dslify_writer
This commit is contained in:
parent
0e367a5241
commit
905a76583e
1 changed files with 10 additions and 15 deletions
|
@ -11,19 +11,6 @@ elsif ENV['EVENT']
|
||||||
puts "Using Evented Mongrel"
|
puts "Using Evented Mongrel"
|
||||||
end
|
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:
|
module Rack #:nodoc:
|
||||||
|
|
||||||
class Request #:nodoc:
|
class Request #:nodoc:
|
||||||
|
@ -785,8 +772,6 @@ module Sinatra
|
||||||
|
|
||||||
attr_accessor :request, :response
|
attr_accessor :request, :response
|
||||||
|
|
||||||
dslify_writer :status, :body
|
|
||||||
|
|
||||||
def initialize(request, response, route_params)
|
def initialize(request, response, route_params)
|
||||||
@request = request
|
@request = request
|
||||||
@response = response
|
@response = response
|
||||||
|
@ -794,6 +779,16 @@ module Sinatra
|
||||||
@response.body = nil
|
@response.body = nil
|
||||||
end
|
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
|
def params
|
||||||
@params ||= begin
|
@params ||= begin
|
||||||
h = Hash.new {|h,k| h[k.to_s] if Symbol === k}
|
h = Hash.new {|h,k| h[k.to_s] if Symbol === k}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue