Module: RailsTwirp::RenderPb

Included in:
Base
Defined in:
lib/rails_twirp/render_pb.rb

Overview

RenderPb makes it possible to do ‘render pb: <proto object>’, skipping templates The way this module is written is inspired by ActionController::Renderers

Instance Method Summary collapse

Instance Method Details

#_render_to_body_with_pb(options) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/rails_twirp/render_pb.rb', line 11

def _render_to_body_with_pb(options)
  if options.include? :pb
    _process_options(options)
    return options[:pb]
  end

  nil
end

#render_to_body(options) ⇒ Object



7
8
9
# File 'lib/rails_twirp/render_pb.rb', line 7

def render_to_body(options)
  _render_to_body_with_pb(options) || super
end