class MR

Public Class Methods

new() click to toggle source
# File lib/multi_render/mr.rb, line 2
def initialize
  @data = {}
end

Public Instance Methods

add(name, route, data) click to toggle source
# File lib/multi_render/mr.rb, line 6
def add(name, route, data)
  @data[name.to_s] = {
    data_array: data,
    render_partial: ->(x) {x.call({partial: route, locals: @data[name.to_s][:data_array]})}
  }
end
get_data() click to toggle source
# File lib/multi_render/mr.rb, line 17
def get_data
  @data
end
render_partial(name, _render) click to toggle source
# File lib/multi_render/mr.rb, line 13
def render_partial(name, _render)
  @data[name.to_s][:render_partial].call(_render)
end