module Interchangeable

Constants

VERSION

Attributes

methods[RW]

Public Class Methods

define(the_class, method_name, &block) click to toggle source
# File lib/interchangeable.rb, line 37
def define the_class, method_name, &block
  entry = Interchangeable.methods.select { |x| x.target == the_class && x.method_name && method_name == x.method_name }.first
  unless entry
    entry = Interchangeable.methods.select { |x| x.target == the_class.singleton_class && x.method_name && method_name == x.method_name }.first
  end
  entry.target.instance_eval do
    define_method method_name, &block
  end
  entry.implemented = true
  entry.default     = false
end
missing_methods() click to toggle source
# File lib/interchangeable.rb, line 33
def missing_methods
  methods.reject { |m| m.implemented }
end