Sha256: e12b0b00e5a23e46ad7c7c70c1226b260eeb2050a11067250ea2580d6882fba4
Contents?: true
Size: 980 Bytes
Versions: 2
Compression:
Stored size: 980 Bytes
Contents
require 'spruz/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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spruz-0.2.13 | lib/spruz/xt/named.rb |
spruz-0.2.12 | lib/spruz/xt/named.rb |