Sha256: 2e70593a36e0e1a9fceb16284efbb3f23485c85985fe2a5dad89b7a8e0a3c4a7

Contents?: true

Size: 311 Bytes

Versions: 20

Compression:

Stored size: 311 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'
require 'set'

Array.class_eval do
  # :nodoc:
  def find!(&block)
    x = find(&block)
    raise(RubyRailsExtensions::Errors::NotFoundError, 'Not found') if x.nil?

    x
  end
end

Set.class_eval do
  extend Forwardable

  def_delegators :to_a, :find!
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ruby-rails-extensions-2.1.1 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.14 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.13 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.12 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.11 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.10 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.9 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.8 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.7 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.6 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.5 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.4 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.3 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.2 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.1.0.pre.rc.1 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.0.1 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.0.1.pre.rc.1 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.0.0 lib/ruby-rails-extensions/extensions/find_bang.rb
ruby-rails-extensions-2.0.0.pre.rc.1 lib/ruby-rails-extensions/extensions/find_bang.rb