Sha256: f1b9a05bb381e636d6d19e907af54e4a7b78a3caa5dc61575bf703536fd0b1ea

Contents?: true

Size: 388 Bytes

Versions: 4

Compression:

Stored size: 388 Bytes

Contents

# frozen_string_literal: true

class Object
  # Raises a ArgumentError if +self+ is not a +klass+.
  #
  # @return +self+
  def assert_argument(klass, argument_name = 'unknown_argument_name')
    return self if is_a?(klass)
    raise ::ArgumentError,
          "Argument \"#{argument_name}\" is not a #{klass}" \
          "(Actual class: #{self.class}, actual value: #{self})"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eac_ruby_utils-0.12.0 lib/eac_ruby_utils/patches/object/asserts.rb
eac_ruby_utils-0.11.0 lib/eac_ruby_utils/patches/object/asserts.rb
eac_ruby_utils-0.10.1 lib/eac_ruby_utils/patches/object/asserts.rb
eac_ruby_utils-0.10.0 lib/eac_ruby_utils/patches/object/asserts.rb