Sha256: 61e3c811237fd16e36a1338c488d0c99e221170d9d63215c6bf09440cdf96fbe

Contents?: true

Size: 745 Bytes

Versions: 2

Compression:

Stored size: 745 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:PrimaDonnaMethod 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

2 entries across 2 versions & 1 rubygems

Version Path
business_flow-0.18.1 lib/business_flow/compat.rb
business_flow-0.18.0 lib/business_flow/compat.rb