Class: EZML::Helpers::ErrorReturn
Instance Method Summary collapse
-
#initialize(method) ⇒ ErrorReturn
constructor
A new instance of ErrorReturn.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(method) ⇒ ErrorReturn
Returns a new instance of ErrorReturn.
7 8 9 10 11 12 13 |
# 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 |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/ezml/helpers.rb', line 27 def inspect "EZML::Helpers::ErrorReturn(#{@message.inspect})" end |
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# 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 |