Sha256: 8626b030f51cc43749f8dbd49496b8370f028d8975e66b6d03875e81320316c5

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

module WrapIt
  #
  # Provides render function for Rails
  #
  # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
  #
  module Renderer
    def self.included(base)
      base == Base || fail(
        TypeError,
        "#{self.class.name} can be included only into WrapIt::Base"
      )
    end

    protected

    def empty_html
      ''.html_safe
    end

    def html_safe(text)
      text.html_safe
    end

    def html_safe?(text)
      text.html_safe?
    end

    def superhtml(text)
      text.to_s
    end

    def capture(*args, &block)
      @template.capture(*args, &block)
    end

    def concat(*args, &block)
      @template.concat(*args, &block)
    end

    def content_tag(*args, &block)
      @template.content_tag(*args, &block)
    end

    def output_buffer(*args, &block)
      @template.output_buffer(*args, &block)
    end


#    def self.included(base)
#      puts "LOADED"
#      base.class_eval do
#        delegate :capture, :concat, :content_tag,
#                 :output_buffer, to: :@template
#        protected :capture, :concat, :content_tag,
#                  :output_buffer
#      end
#    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wrap_it-1.0.2 lib/wrap_it/rails.rb
wrap_it-1.0.1 lib/wrap_it/rails.rb
wrap_it-1.0.0 lib/wrap_it/rails.rb
wrap_it-0.2.0 lib/wrap_it/rails.rb
wrap_it-0.1.5 lib/wrap_it/rails.rb
wrap_it-0.1.4 lib/wrap_it/rails.rb