Sha256: 98a659b7a2c3d54a08799f6f30f381771cfbfc7db4f0c243c3b517ee0126b8e9

Contents?: true

Size: 824 Bytes

Versions: 8

Compression:

Stored size: 824 Bytes

Contents

module Pervasives
  VERSION = "1.0.0"
  def self.version() VERSION end
  class ::Class 
    def __pervasive__ m, *a, &b
      (( Class.instance_method(m) rescue Module.instance_method(m) rescue Object.instance_method(m) )).bind(self).call(*a, &b)
    end
  end
  class ::Module 
    def __pervasive__ m, *a, &b
      (( Module.instance_method(m) rescue Object.instance_method(m) )).bind(self).call(*a, &b)
    end
  end
  class ::Object
    def __pervasive__ m, *a, &b
      (( Object.instance_method(m) )).bind(self).call(*a, &b)
    end
  end

  class Proxy
    instance_methods.each{|m| undef_method m unless m[%r/__/]}
    def initialize obj
      @obj = obj
    end
    def method_missing m, *a, &b
      @obj.__pervasive__ m, *a, &b
    end
    def __obj__
      @obj
    end
  end
end

Version data entries

8 entries across 5 versions & 2 rubygems

Version Path
flatulent-0.0.4 lib/flatulent/pervasives.rb
flatulent-0.0.3 rails/lib/flatulent/pervasives.rb
flatulent-0.0.1 lib/flatulent/pervasives.rb
flatulent-0.0.2 lib/flatulent/pervasives.rb
flatulent-0.0.2 rails/lib/flatulent/pervasives.rb
flatulent-0.0.3 lib/flatulent/pervasives.rb
pervasives-1.0.0 lib/pervasives-1.0.0.rb
pervasives-1.0.0 lib/pervasives.rb