Class: Gnarly::Environment

Inherits:
Object
  • Object
show all
Includes:
Haml, Provides, Typhoeus, Understands
Defined in:
lib/gnarly/haml.rb,
lib/gnarly/typhoeus.rb,
lib/gnarly/environment.rb

Instance Method Summary collapse

Methods included from Understands

#understands

Methods included from Status

#created, #default_content_type, #internal_server_error, #method_not_allowed, #not_acceptable, #not_found, #ok, #pop_default_content_type, #push_default_content_type, #unsupported_media_type

Methods included from Base

#body_charset, #logger, #request, #state

Methods included from Provides

#parameters, #provides

Methods included from Typhoeus

make_headers, make_rack_response, #typhoeus

Methods included from Haml

#haml

Constructor Details

#initialize(app) ⇒ Environment

Returns a new instance of Environment.



11
12
13
14
# File 'lib/gnarly/environment.rb', line 11

def initialize(app)
  @application = app
  push_default_content_type "text/plain"
end

Instance Method Details

#applicationObject



16
17
18
# File 'lib/gnarly/environment.rb', line 16

def application()
  @application
end

#helper(helper = nil, &block) ⇒ Object



20
21
22
23
# File 'lib/gnarly/environment.rb', line 20

def helper(helper=nil, &block)
  helper = Module.new &block if block and not helper
  extend helper
end

#response(response = nil) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/gnarly/environment.rb', line 25

def response(response=nil)
  if response
    @response = response
  else
    response
  end
end