Sha256: dc7be89c530ff8709920b8515505282a8e8121f478f484bc1f9c39968529c9ee

Contents?: true

Size: 376 Bytes

Versions: 2

Compression:

Stored size: 376 Bytes

Contents

# encoding: utf-8

module AddMethodMissing
  def add_method_missing(name = :described_class)
    before do
      # when #optimize delegates to super, it would normally
      # explode, so define method_missing to return self
      public_send(name).class_eval do
        undef_method :method_missing
        define_method(:method_missing) { self }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/support/add_method_missing.rb
axiom-optimizer-0.1.1 spec/support/add_method_missing.rb