Class: ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::Delegation

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object:, method:, args:, kwargs:, block:) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • object (Object)

    Can be any type.

  • method (Symbol)
  • args (Array<Object>)
  • kwargs (Hash{Symbol => Object})
  • block (Proc, nil)


49
50
51
52
53
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 49

def initialize(object:, method:, args:, kwargs:, block:)
  @object = object
  @method = method
  @arguments = Support::Arguments.new(*args, **kwargs, &block)
end

Instance Attribute Details

#argumentsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 21

def arguments
  @arguments
end

#methodObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 29

def method
  @method
end

#objectObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 37

def object
  @object
end

Instance Method Details

#==(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


79
80
81
82
83
84
85
86
87
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 79

def ==(other)
  return unless other.instance_of?(self.class)

  return false if object != other.object
  return false if method != other.method
  return false if arguments != other.arguments

  true
end

#with_arguments?Booleam

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Booleam)


60
61
62
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 60

def with_arguments?
  arguments.any?
end

#without_arguments?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


69
70
71
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 69

def without_arguments?
  !with_arguments?
end