Sha256: 1d59c3799be112b15d8784fe9f483a46038a35db8b4934328f5681a96b516671

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

# Basically copied and pasted from JbuilderHandler, except it uses Pbbuilder

class PbbuilderHandler
  # 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.
  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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pbbuilder-0.2.1 lib/pbbuilder/handler.rb
pbbuilder-0.2.0 lib/pbbuilder/handler.rb
pbbuilder-0.1.0 lib/pbbuilder/handler.rb