Sha256: 6ccabd9347411405590486e62ef277ff593fa117bbf965689ccf3c31997cc3c5

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

module Clowne
  module Ext # :nodoc: all
    # Add yield_self and then if missing
    module YieldSelfThen
      module Ext
        unless nil.respond_to?(:yield_self)
          def yield_self
            yield self
          end
        end

        alias then yield_self
      end

      # See https://github.com/jruby/jruby/issues/5220
      ::Object.include(Ext) if RUBY_PLATFORM =~ /java/i

      refine Object do
        include Ext
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clowne-1.1.0 lib/clowne/ext/yield_self_then.rb
clowne-1.0.0 lib/clowne/ext/yield_self_then.rb