Class: Object

Inherits:
BasicObject
Defined in:
lib/stratagem/extensions/object.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.sg_subclassesObject



10
11
12
13
14
15
16
17
18
# File 'lib/stratagem/extensions/object.rb', line 10

def self.sg_subclasses
  classes = []
  ObjectSpace.each_object(Class) do |c|
    next unless c.superclass == self || c.ancestors.include?(self)
    next if c == self
    classes << c
  end
  classes
end

Instance Method Details

#methods_include?(name) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
8
# File 'lib/stratagem/extensions/object.rb', line 2

def methods_include?(name)
  if (methods.first.kind_of?(String))
    methods.include?(name.to_s)
  else
    methods.include?(name.to_sym)
  end
end