Class: Symbol

Inherits:
Object show all
Defined in:
lib/ae/core_ext/helpers.rb

Instance Method Summary collapse

Instance Method Details

#thrown?(*args) ⇒ Boolean

Does the block throw this symbol?

Returns:

  • (Boolean)

173
174
175
176
177
178
179
180
181
182
183
# File 'lib/ae/core_ext/helpers.rb', line 173

def thrown?(*args)
  catch(self) do
    begin
      yield(*args)
    rescue ArgumentError  # 1.9 exception
    rescue NameError      # 1.8 exception
    end
    return false
  end
  return true
end