Sha256: ae7a9bd7de359938ed3fb651255fbda74951a96c48afedf3734b44ac91f1ead3

Contents?: true

Size: 311 Bytes

Versions: 1

Compression:

Stored size: 311 Bytes

Contents

module BlankSlate
  def BlankSlate(klass, default_value: nil, &block)
    blank_slate = Class.new(klass, &block)
    blank_slate.class_eval do
      (klass.instance_methods(false) - instance_methods(false)).each do |meth|
        define_method(meth){ default_value }
      end
    end
    blank_slate
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blank_slate-1.1.3 lib/blank_slate.rb