Module: Gnarly::Base

Included in:
Provides, Understands
Defined in:
lib/gnarly/base.rb

Instance Method Summary collapse

Instance Method Details

#body_charset(body) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/gnarly/base.rb', line 23

def body_charset(body)
  charset = nil
  body.each do |s|
    charset = s.encoding.to_s
    break
  end
  charset
end

#loggerObject



19
20
21
# File 'lib/gnarly/base.rb', line 19

def logger()
  @state["rack.logger"]
end

#requestObject



15
16
17
# File 'lib/gnarly/base.rb', line 15

def request()
  @request ||= Request.new @state
end

#state(state = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/gnarly/base.rb', line 7

def state(state=nil)
  if state
    @state = state
    @request = nil
  end
  @state
end