Class: Module

Inherits:
Object show all
Defined in:
lib/ae/basic_object.rb,
lib/ae/core_ext/helpers.rb

Overview

Also, modules included into Object need to be scanned and have their instance methods removed from blank slate. In theory, modules included into Kernel would have to be removed as well, but a “feature” of Ruby prevents late includes into modules from being exposed in the first place.

Instance Method Summary collapse

Instance Method Details

#append_features(mod) ⇒ Object



101
102
103
104
105
106
107
108
# File 'lib/ae/basic_object.rb', line 101

def append_features(mod)
  result = basic_object_original_append_features(mod)
  return result if mod != Object
  instance_methods.each do |name|
    AE::BasicObject.hide(name)
  end
  result
end

#basic_object_original_append_featuresObject

:nodoc:



100
# File 'lib/ae/basic_object.rb', line 100

alias basic_object_original_append_features append_features

#is?(base) ⇒ Boolean

Is a given class or module an ancestor of this class or module?

class X ; end
class Y < X ; end

 Y.is?(X)  #=> true

Returns:

  • (Boolean)


131
132
133
# File 'lib/ae/core_ext/helpers.rb', line 131

def is?(base)
  Module===base && ancestors.slice(1..-1).include?(base)
end