Class: PbbuilderHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/pbbuilder/handler.rb

Overview

Basically copied and pasted from JbuilderHandler, except it uses Pbbuilder

Class Method Summary collapse

Class Method Details

.call(template, source = nil) ⇒ Object

This builds up a Ruby string, that Rails’ templating system ‘eval`s to create the view result. In our case the view result is a Protobuf message.



6
7
8
9
10
11
# File 'lib/pbbuilder/handler.rb', line 6

def self.call(template, source = nil)
  source ||= template.source
  # We need to keep `source` on the first line, so line numbers are correct if there's an error
  %{pb=Pbbuilder.new(@_response_class.new); #{source}
    pb.target!}
end