Class: Tipi::Configuration::Interpreter

Inherits:
Object
  • Object
show all
Defined in:
lib/tipi/config_dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(assembler) ⇒ Interpreter

make_blank_slate



8
9
10
# File 'lib/tipi/config_dsl.rb', line 8

def initialize(assembler)
  @assembler = assembler
end

Instance Method Details

#error(&block) ⇒ Object



20
21
22
# File 'lib/tipi/config_dsl.rb', line 20

def error(&block)
  assembler.emit_exception_handler &block
end

#gzip_responseObject



12
13
14
# File 'lib/tipi/config_dsl.rb', line 12

def gzip_response
  @assembler.emit 'req = Tipi::GZip.wrap(req)'
end

#log(out) ⇒ Object



16
17
18
# File 'lib/tipi/config_dsl.rb', line 16

def log(out)
  @assembler.wrap_current_frame 'logger.log_request(req) do |req|'
end

#match(pattern, &block) ⇒ Object



24
25
26
# File 'lib/tipi/config_dsl.rb', line 24

def match(pattern, &block)
  @assembler.emit_conditional "if req.path =~ #{pattern.inspect}", &block
end