Sha256: c6ccf20f5ef17e6bd363b91a81bf02873aba8d978e8a151187b68946c1d6556b

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module Rtml::Controller::RenderHelpers
  def render_with_rtml_option(options = nil, extra_options = {}, &block)
    if (h = options).is_a?(Hash) || (h = extra_options).is_a?(Hash)
      h = extra_options if !h.key?(:rtml) && extra_options.is_a?(Hash)
      if rtml_action = h.delete(:rtml)
        if rtml_helpers.respond_to?(rtml_action)
          request.format = :rtml
          rtml_helpers.send(rtml_action)
          set_rtml_headers
          response.template.template_format = :rtml
          tml = rtml_document.to_tml
          if Rtml.configuration.log_tml
            Rails.logger.debug tml
          end
          return render_without_rtml_option(h.merge(:text => tml))
        else
          raise Rtml::Errors::UnknownRtmlAction,
                "No RTML action responded to #{rtml_action}. RTML actions: #{rtml_actions.sort.to_sentence(:locale => :en)}",
                caller
        end
      end
    end
    render_without_rtml_option(options, extra_options, &block)
  end

  def self.included(base)
    base.send(:alias_method_chain, :render, :rtml_option)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtml-2.0.3 lib/rtml/controller/render_helpers.rb
rtml-2.0.2 lib/rtml/controller/render_helpers.rb
rtml-2.0.1 lib/rtml/controller/render_helpers.rb
rtml-2.0.0.alpha.1 lib/rtml/controller/render_helpers.rb