Sha256: c81c29a5b269b508ffb8678e3f49f5b6623f5f8fc870dcc71287f55bffd788d4

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

module Nitro

module PrototypeHelper

  def remote_function()
  end

  #--
  # TODO: resolve html
  #++
  
  class JavascriptGenerator
    attr_accessor :buffer
    
    def initialize
      @buffer = ''
    end

    # html = A string or a symbol to an action for rendering.
    #--
    # TODO: resolve html.
    #++
    
    def insert_html(id, html, options = {})
      position = options.fetch(:where, :before)
      record "new Insertion.#{position.to_s.camelize}(#{id.inspect}, #{html.inspect})"
    end

    def replace_html(id, html, options = {})
      record "Element.update(#{id.inspect}, #{html.inspect})"
    end
   
  private
    
    def record(code)
      code = "#{line.to_s.chomp.gsub /\;$/, ''};"
      @buffer << code
      return code
    end    
    
  end



end

end

# * George Moschovitis <gm@navel.gr>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.26.0 lib/nitro/helper/prototype.rb