Sha256: 611252f11b8de35f9f843eae8f080a528e4a749b0df80d1053e552ed713a2daa

Contents?: true

Size: 501 Bytes

Versions: 4

Compression:

Stored size: 501 Bytes

Contents

class ExtraBlankSlate
  PRESERVE_METHODS = %w(object_id)
  instance_methods.each { |m| undef_method m unless m =~ /^__/ or PRESERVE_METHODS.include?(m.to_s)}
  
  CUSTOM_UNDEFINE = [:p, :select, :puts]
    
  undefine = Kernel.instance_methods + Object.instance_methods + CUSTOM_UNDEFINE
  ExtraBlankSlate.instance_methods.each{|m| undefine.delete m}
  
  undefine.each do |m|
    script = %{\
def #{m} *p, &b
  method_missing :#{m}, *p, &b
end}
    class_eval script, __FILE__, __LINE__
  end    
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby_ext-0.4.11 lib/ruby_ext/extra_blank_slate.rb
ruby_ext-0.4.10 lib/ruby_ext/extra_blank_slate.rb
ruby_ext-0.4.9 lib/ruby_ext/extra_blank_slate.rb
ruby_ext-0.4.7 lib/ruby_ext/extra_blank_slate.rb