Sha256: eb78e44fe384184d355de340596d41abaf7d174c38dca8dbf9913bc917c1ed90

Contents?: true

Size: 392 Bytes

Versions: 6

Compression:

Stored size: 392 Bytes

Contents

class Symbol

  # Does the block throw the symbol?
  # 
  def thrown?
    catch(self) do
      begin
        yield
        true
      rescue ArgumentError => err     # 1.9 exception
        #msg += ", not #{err.message.split(/ /).last}"
        false
      rescue NameError => err         # 1.8 exception
        #msg += ", not #{err.name.inspect}"
        false
      end
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/symbol/thrown.rb
facets-2.8.3 lib/core/facets/symbol/thrown.rb
facets-2.8.2 lib/core/facets/symbol/thrown.rb
facets-2.8.1 lib/core/facets/symbol/thrown.rb
facets-2.8.0 lib/core/facets/symbol/thrown.rb
facets-2.7.0 lib/core/facets/symbol/thrown.rb