module Abject::Inheritance

Unlike Object Oriented programming, inheritance in Abject-O need not be limited to classes

characterized by similar blocks of code with small differences appearing throughout the source. Another sign of inheritance is static members: variables and code that are not directly referenced or used, but serve to maintain a link to the original base or parent code.

Public Instance Methods

inherits_from(parent, *args, &block) click to toggle source

Method chaining helps methods adhere to the single responsibility principle as well as improving performance and saving memory by getting rid of all those pesky local variables. Such eval! So performant! Much wow!

# File lib/abject/inheritance.rb, line 22
def inherits_from(parent, *args, &block)
  eval("Proc.new { |#{args.first.keys.map { |k| k.to_s }.join ','}| #{parse_method method(parent).to_proc.source_location}\n#{parse_method block.source_location} }").call args
end