Sha256: 17108ea09571ed3ef5a0cd3f684ec4f76f6c98eeeecefae759908a86f00e556e

Contents?: true

Size: 853 Bytes

Versions: 112

Compression:

Stored size: 853 Bytes

Contents

require 'singleton'

module Tins

  SexySingleton = Singleton.dup

  module SexySingleton
    module SingletonClassMethods
    end
  end

  class << SexySingleton
    alias __old_singleton_included__ included

    def included(klass)
      __old_singleton_included__(klass)
      (class << klass; self; end).class_eval do
        if Object.method_defined?(:respond_to_missing?)
          def  respond_to_missing?(name, *args)
            instance.respond_to?(name) || super
          end
        else
          def respond_to?(name, *args)
            instance.respond_to?(name) || super
          end
        end

        def method_missing(name, *args, &block)
          if instance.respond_to?(name)
            instance.__send__(name, *args, &block)
          else
            super
          end
        end
      end
      super
    end
  end
end

Version data entries

112 entries across 101 versions & 9 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/sexy_singleton.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/lib/tins/sexy_singleton.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/lib/tins/sexy_singleton.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/sexy_singleton.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/sexy_singleton.rb
tins-1.26.0 lib/tins/sexy_singleton.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/lib/tins/sexy_singleton.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/tins-1.25.0/lib/tins/sexy_singleton.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/lib/tins/sexy_singleton.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/lib/tins/sexy_singleton.rb
tins-1.25.0 lib/tins/sexy_singleton.rb
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/tins-1.24.1/lib/tins/sexy_singleton.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/lib/tins/sexy_singleton.rb
tins-1.24.1 lib/tins/sexy_singleton.rb
tins-1.24.0 lib/tins/sexy_singleton.rb
tins-1.23.0 lib/tins/sexy_singleton.rb
tdiary-5.1.0 vendor/bundle/gems/tins-1.22.2/lib/tins/sexy_singleton.rb
tins-1.22.2 lib/tins/sexy_singleton.rb
tins-1.22.1 lib/tins/sexy_singleton.rb
tins-1.22.0 lib/tins/sexy_singleton.rb