Sha256: eefc3d1fd112663337233418db866776c2cb590f15e38cd557a720cc324a61a8

Contents?: true

Size: 746 Bytes

Versions: 5

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

module BusinessFlow
  # Provides compatibility for ActiveSupport/Model 4.x through 7.x
  module Compat
    if !Module.instance_methods.include?(:module_parents)
      # ActiveSupport 5 removed #parents in favor of #module_parents.
      class ::Module
        def module_parents
          parents
        end
      end
    end

    if !ActiveModel::Errors.instance_methods.include?(:merge!)
      # ActiveModel 5 added details (which we do not use here) and #merge!
      # :reek:MissingSafeMethod Look it's the API.
      class ::ActiveModel::Errors
        def merge!(other)
          other.each do |attribute, message|
            self[attribute] << message
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
business_flow-0.19.4 lib/business_flow/compat.rb
business_flow-0.19.3 lib/business_flow/compat.rb
business_flow-0.19.2 lib/business_flow/compat.rb
business_flow-0.19.1 lib/business_flow/compat.rb
business_flow-0.19.0 lib/business_flow/compat.rb