Class: Haml::Helpers::ErrorReturn

Inherits:
Object
  • Object
show all
Defined in:
lib/haml/helpers.rb

Overview

An object that raises an error when #to_s is called. It’s used to raise an error when the return value of a helper is used when it shouldn’t be.

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ ErrorReturn

Returns a new instance of ErrorReturn.



14
15
16
# File 'lib/haml/helpers.rb', line 14

def initialize(message)
  @message = message
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/haml/helpers.rb', line 22

def inspect
  "Haml::Helpers::ErrorReturn(#{@message.inspect})"
end

#to_sObject

Raises:



18
19
20
# File 'lib/haml/helpers.rb', line 18

def to_s
  raise Haml::Error.new(@message)
end