class EZML::Helpers::ErrorReturn

Public Class Methods

new(method) click to toggle source
# File lib/ezml/helpers.rb, line 7
      def initialize(method)
        @message = <<MESSAGE
#{method} outputs directly to the EZML template.
Disregard its return value and use the - operator,
or use capture_ezml to get the value as a String.
MESSAGE
      end

Public Instance Methods

inspect() click to toggle source
# File lib/ezml/helpers.rb, line 27
def inspect
  "EZML::Helpers::ErrorReturn(#{@message.inspect})"
end
to_s() click to toggle source
# File lib/ezml/helpers.rb, line 15
def to_s
  raise EZML::Error.new(@message)
rescue EZML::Error => e
  e.backtrace.shift

  if e.backtrace.first =~ /^\(eval\):\d+:in `format_script/
    e.backtrace.shift
    e.backtrace.first.gsub!(/^\(ezml\):(\d+)/) {|s| "(ezml):#{$1.to_i - 1}"}
  end
  raise e
end