Methods

Files

DSLKit::BlankSlate

Public Class Methods

with(*ids) click to toggle source

Creates an anonymous blank slate class, that only responds to the methods *ids. ids can be Symbols, Strings, and Regexps that have to match the method name with #===.

# File lib/dslkit/polite.rb, line 375
    def self.with(*ids)
      ids = ids.map { |id| Regexp === id ? id : id.to_s }
      klass = Class.new
      klass.instance_eval do
        instance_methods.each do |m|
          m = m.to_s
          undef_method m unless m =~ /^(__|object_id)/ or ids.any? { |i| i === m }
        end
      end
      klass
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.