Module Erubis::PrintEnabledEnhancer
In: erubis/enhancer.rb

enable print function

Notice: use Eruby#evaluate() and don‘t use Eruby#result() to be enable print function.

this is only for Eruby.

Methods

Public Instance methods

[Source]

# File erubis/enhancer.rb, line 128
    def add_preamble(src)
      src << "@_buf = "
      super
    end

[Source]

# File erubis/enhancer.rb, line 139
    def evaluate(context=nil)
      _src = @src
      if context.is_a?(Hash)
        context.each do |key, val| instance_variable_set("@#{key}", val) end
      elsif context
        context.instance_variables.each do |name|
          instance_variable_set(name, context.instance_variable_get(name))
        end
      end
      return instance_eval(_src, (@filename || '(erubis)'))
    end

[Source]

# File erubis/enhancer.rb, line 133
    def print(*args)
      args.each do |arg|
        @_buf << arg.to_s
      end
    end

[Validate]