Sha256: 83ee812eb140a24b02b6778fdf66c59dcbb9491f84f0eca740b2c148f668ab55

Contents?: true

Size: 972 Bytes

Versions: 15

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Utils
    module Method
      class Defined < Support::Command
        ##
        # @!attribute [r] method
        #   @return [Class]
        #
        attr_reader :method

        ##
        # @!attribute [r] klass
        #   @return [Class]
        #
        attr_reader :klass

        ##
        # @!attribute [r] klass
        #   @return [Class]
        #
        attr_reader :private

        ##
        # @param method [Symbol, String]
        # @param klass [Class]
        # @return [void]
        #
        def initialize(method, klass, private: false)
          @method = method.to_s
          @klass = klass
          @private = private
        end

        ##
        # @return [void]
        #
        def call
          return true if klass.method_defined?(method)

          return klass.private_method_defined?(method) if private

          false
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
convenient_service-0.12.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.11.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.10.1 lib/convenient_service/utils/method/defined.rb
convenient_service-0.10.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.9.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.8.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.7.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.6.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.5.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.4.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.3.1 lib/convenient_service/utils/method/defined.rb
convenient_service-0.3.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.2.1 lib/convenient_service/utils/method/defined.rb
convenient_service-0.2.0 lib/convenient_service/utils/method/defined.rb
convenient_service-0.1.0 lib/convenient_service/utils/method/defined.rb