Sha256: e6ef651ad3410d630f647563dc60eaa7b14b0f5ec865ac014e7caf660a4429eb

Contents?: true

Size: 330 Bytes

Versions: 6

Compression:

Stored size: 330 Bytes

Contents

# frozen_string_literal: true

Object.class_eval do
  unless method_defined?(:presence!)
    # Returns self if `present?`
    #
    # @raise [BlankObject] if `blank?`
    #
    # @return [*]
    #
    def presence!
      raise(RubyRailsExtensions::Errors::BlankObjectError, 'Blank object') if blank?

      self
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-rails-extensions-1.1.1 lib/ruby-rails-extensions/extensions/presence_bang.rb
ruby-rails-extensions-1.1.1.pre.rc.1 lib/ruby-rails-extensions/extensions/presence_bang.rb
ruby-rails-extensions-0.2.0 lib/ruby-rails-extensions/extensions/presence_bang.rb
ruby-rails-extensions-0.2.0.pre.rc.1 lib/ruby-rails-extensions/extensions/presence_bang.rb
ruby-rails-extensions-1.1.0 lib/ruby-rails-extensions/extensions/presence_bang.rb
ruby-rails-extensions-1.1.0.pre.rc.1 lib/ruby-rails-extensions/extensions/presence_bang.rb