Sha256: c2016fa2de3873f56bd11b24177f10be9514d805b66ecc9d7e9892c15d590038

Contents?: true

Size: 300 Bytes

Versions: 2

Compression:

Stored size: 300 Bytes

Contents

module RSpecCandy
  module Helpers
    module DisposableCopy

      def disposable_copy(&body)
        this = self
        copy = Class.new(self, &body)
        copy.singleton_class.send(:define_method, :name) { this.name }
        copy
      end

      Class.send(:include, self)

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec_candy-0.1.1 lib/rspec_candy/helpers/disposable_copy.rb
rspec_candy-0.1.0 lib/rspec_candy/helpers/disposable_copy.rb