Sha256: 63bffbc51008fa6cdf381407485accc34c1a8c2ac31ac9450b106c2151bdf05a

Contents?: true

Size: 979 Bytes

Versions: 53

Compression:

Stored size: 979 Bytes

Contents

require 'tins/xt/string_version'

class Object
  if RUBY_VERSION.version >= '1.9'.version
    def named(name, method, *args, &named_block)
      extend Module.new {
        define_method(name) do |*rest, &block|
          block = named_block if named_block
          __send__(method, *(args + rest), &block)
        end
      }
    end
  else
    def named(name, method, *args, &block)
      extend Module.new { define_method(name) { |*rest| __send__(method, *(args + rest), &block) } }
    end
  end
end

class Module
  if RUBY_VERSION.version >= '1.9'.version
    def named(name, method, *args, &named_block)
      include Module.new {
        define_method(name) do |*rest, &block|
          block = named_block if named_block
          __send__(method, *(args + rest), &block)
        end
      }
    end
  else
    def named(name, method, *args, &block)
      include Module.new { define_method(name) { |*rest| __send__(method, *(args + rest), &block) } }
    end
  end
end

Version data entries

53 entries across 52 versions & 3 rubygems

Version Path
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/lib/tins/xt/named.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/lib/tins/xt/named.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/tins-0.13.2/lib/tins/xt/named.rb
tdiary-5.0.8 vendor/bundle/gems/tins-0.13.2/lib/tins/xt/named.rb
tins-1.3.0 lib/tins/xt/named.rb
tins-1.2.0 lib/tins/xt/named.rb
tins-1.1.0 lib/tins/xt/named.rb
tins-1.0.1 lib/tins/xt/named.rb
tins-1.0.0 lib/tins/xt/named.rb
tins-0.13.2 lib/tins/xt/named.rb
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/tins-0.13.1/lib/tins/xt/named.rb
tins-0.13.1 lib/tins/xt/named.rb
tins-0.13.0 lib/tins/xt/named.rb
tins-0.12.0 lib/tins/xt/named.rb
tins-0.11.0 lib/tins/xt/named.rb
tins-0.10.0 lib/tins/xt/named.rb
tins-0.9.0 lib/tins/xt/named.rb
tins-0.8.4 lib/tins/xt/named.rb
tins-0.8.3 lib/tins/xt/named.rb
tins-0.8.2 lib/tins/xt/named.rb