Sha256: 524b160b228b0a05974ac78842d3d7beed3530580a56d2c7a7c135ebbf9f9a63

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Dependencies
    module Queries
      module Gems
        ##
        # @api private
        #
        class ActiveModel
          class << self
            ##
            # @return [Boolean]
            #
            # @internal
            #   `Style/TernaryParentheses` is disabled since `defined?` has too low priority without parentheses.
            #
            # rubocop:disable Style/TernaryParentheses
            def loaded?
              (defined? ::ActiveModel) ? true : false
            end
            # rubocop:enable Style/TernaryParentheses

            ##
            # @return [ConvenientService::Dependencies::Queries::Version]
            #
            # @internal
            #   https://github.com/rails/rails/blob/main/activemodel/lib/active_model/version.rb
            #
            def version
              loaded? ? Version.new(::ActiveModel.version) : Version.null_version
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/dependencies/queries/gems/active_model.rb
convenient_service-0.19.0 lib/convenient_service/dependencies/queries/gems/active_model.rb