Class: PbbuilderHandler
- Inherits:
-
Object
- Object
- PbbuilderHandler
- Defined in:
- lib/pbbuilder/handler.rb
Overview
Basically copied and pasted from JbuilderHandler, except it uses Pbbuilder
Class Method Summary collapse
-
.call(template, source = nil) ⇒ Object
This builds up a Ruby string, that Rails’ templating system ‘eval`s to create the view result.
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.
8 9 10 11 12 13 |
# File 'lib/pbbuilder/handler.rb', line 8 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 %{__already_defined = defined?(pb); pb ||= PbbuilderTemplate.new(self, @_response_class.new); #{source} pb.target! unless (__already_defined && __already_defined != "method")} end |