Sha256: 8bfa4a167d7e6174586e927fbc46121324993ac97689fc3b350b888ed96bc186

Contents?: true

Size: 504 Bytes

Versions: 15

Compression:

Stored size: 504 Bytes

Contents

# frozen_string_literal: true

module ActionPolicy
  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

15 entries across 15 versions & 1 rubygems

Version Path
action_policy-0.4.4 lib/action_policy/ext/yield_self_then.rb
action_policy-0.4.3 lib/action_policy/ext/yield_self_then.rb
action_policy-0.4.2 lib/action_policy/ext/yield_self_then.rb
action_policy-0.4.1 lib/action_policy/ext/yield_self_then.rb
action_policy-0.4.0 lib/action_policy/ext/yield_self_then.rb
action_policy-0.3.4 lib/action_policy/ext/yield_self_then.rb
action_policy-0.3.3 lib/action_policy/ext/yield_self_then.rb
action_policy-0.3.2 lib/action_policy/ext/yield_self_then.rb
action_policy-0.3.1 lib/action_policy/ext/yield_self_then.rb
action_policy-0.3.0 lib/action_policy/ext/yield_self_then.rb
action_policy-0.3.0.beta1 lib/action_policy/ext/yield_self_then.rb
action_policy-0.2.4 lib/action_policy/ext/yield_self_then.rb
action_policy-0.2.3 lib/action_policy/ext/yield_self_then.rb
action_policy-0.2.2 lib/action_policy/ext/yield_self_then.rb
action_policy-0.2.0 lib/action_policy/ext/yield_self_then.rb