class ActionFlow::BlankSlate

Public Class Methods

all_methods(klass, include_ancestors = false) click to toggle source
# File lib/action_flow/blank_slate.rb, line 24
def self.all_methods(klass, include_ancestors = false)
  %w[public protected private].map { |viz|
    klass.__send__("#{viz}_instance_methods", include_ancestors)
  }.
  flatten.map { |m| m.to_sym }.uniq
end
include(mixin) click to toggle source
Calls superclass method
# File lib/action_flow/blank_slate.rb, line 4
def self.include(mixin)
  super(mixin)
  @mixins ||= []
  @mixins << mixin
end
new(*args, &block) click to toggle source
Calls superclass method
# File lib/action_flow/blank_slate.rb, line 10
def self.new(*args, &block)
  remove_inherited_methods
  super(*args, &block)
end
remove_inherited_methods() click to toggle source
# File lib/action_flow/blank_slate.rb, line 15
def self.remove_inherited_methods
  modules = [self] + (@mixins || [])
  
  keepers = modules.inject([]) { |list, klass| list + all_methods(klass) } +
            [:__id__, :__send__, :instance_eval]
  
  undef_method *( all_methods(self, true) - keepers )
end