Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleared up docs of the BasicObject coercion guard.
Browse files Browse the repository at this point in the history
Yorick Peterse committed Jun 30, 2014

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 87c2b85 commit d765183
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions kernel/common/type.rb
Original file line number Diff line number Diff line change
@@ -47,10 +47,18 @@ def self.coerce_to_type_error(original, converted, method, klass)
end

##
# BasicObject responds to pretty much no, if any methods at all. This
# method provides a simple coercion guard for BasicObject instances.
# BasicObject responds to only a select few of methods such as `==` and
# `__send__`. It however does not respond to other methods such as `class`,
# `respond_to?` and other common methods.
#
# Basic example:
# This method provides a guard for code that can not handle BasicObject
# instances. The guard itself is quite simple: it simply raises for
# BasicObject instances.
#
# The first argument is the object to check, the second argument the class
# name that the object would normally be converted into.
#
# Basic usage example:
#
# object = BasicObject.new
#

0 comments on commit d765183

Please sign in to comment.