Sha256: cdb2aa4e469c074f26769ecf84b7868499a7e96397a411fc952d1c209576f712

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module RSpec
    module Matchers
      module Custom
        class DelegateTo
          module Entities
            class Matcher
              module Commands
                class GeneratePrintableMethod < Support::Command
                  ##
                  # @!attribute [r] object
                  #   @return [Object] Can be any type.
                  #
                  attr_reader :object

                  ##
                  # @!attribute [r] method
                  #   @return [Symbol, String]
                  #
                  attr_reader :method

                  ##
                  # @param object [Object] Can by any type.
                  # @param method [Symbol, String]
                  # @return [void]
                  #
                  def initialize(object:, method:)
                    @object = object
                    @method = method
                  end

                  def call
                    case Utils::Object.resolve_type(object)
                    when "class", "module"
                      "#{object}.#{method}"
                    when "instance"
                      "#{object.class}##{method}"
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
convenient_service-0.14.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.13.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.12.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.11.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.10.1 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.10.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.9.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.8.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.7.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb
convenient_service-0.6.0 lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/commands/generate_printable_method.rb