class Class

Public Instance Methods

attr_accessor(*vars) click to toggle source
Calls superclass method
# File lib/ruby_us/extensions/class.rb, line 3
def attr_accessor *vars
  @attributes ||= []
  @attributes.concat vars
  super *vars
end
attr_reader(*vars) click to toggle source
Calls superclass method
# File lib/ruby_us/extensions/class.rb, line 9
def attr_reader *vars
  @attributes ||= []
  @attributes.concat vars
  super *vars
end
attr_writer(*vars) click to toggle source
Calls superclass method
# File lib/ruby_us/extensions/class.rb, line 15
def attr_writer *vars
  @attributes ||= []
  @attributes.concat vars
  super *vars
end
attributes() click to toggle source
# File lib/ruby_us/extensions/class.rb, line 21
def attributes
  @attributes.nil? ? self.new.instance_variables : (self.new.instance_variables | @attributes)
end
descendants() click to toggle source
# File lib/ruby_us/extensions/class.rb, line 29
def descendants
  ObjectSpace.each_object(Class).select do |c|
    c.extend? self
  end
end
extend?(constant) click to toggle source
# File lib/ruby_us/extensions/class.rb, line 25
def extend? constant
  (ancestors - [self]).include? constant
end
is_extended_by?(constant) click to toggle source
# File lib/ruby_us/extensions/class.rb, line 35
def is_extended_by? constant
  descendants.include? constant
end