Sha256: a2462608e35cf9bc94816e2867e0afb7538d42a9bacd5bcc4e3c0ad8b7da2d8b

Contents?: true

Size: 585 Bytes

Versions: 9

Compression:

Stored size: 585 Bytes

Contents

module JellyController
  protected

  def jelly_callback(callback_base_name = @action_name, options = {}, &block)
    render :inline => jelly_callback_erb("on_#{callback_base_name}", options, block)
  end

  def jelly_callback_erb(callback_name, options, block)
    @callback_name = callback_name
    @options = options
    @block = block
    <<-ERB
      <%= begin
        args = @block ? instance_eval(&@block) : []
        args = [args] unless args.is_a?(Array)
        {"method" => @callback_name, "arguments" => args}.reverse_merge(@options).to_json
      end %>
    ERB
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
honkster-honkster-jelly-0.2.0 lib/jelly/jelly_controller.rb
honkster-honkster-jelly-0.3.0 lib/jelly/jelly_controller.rb
pivotal-honkster-jelly-0.3.0 lib/jelly/jelly_controller.rb
pivotal-jelly-0.3.1 lib/jelly/jelly_controller.rb
pivotal-jelly-0.3.5 lib/jelly/jelly_controller.rb
pivotal-jelly-0.4.0 lib/jelly/jelly_controller.rb
pivotal-jelly-0.5.0 lib/jelly/jelly_controller.rb
pivotal-jelly-0.5.1 lib/jelly/jelly_controller.rb
pivotal-jelly-0.5.3 lib/jelly/jelly_controller.rb