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)


44
45
46
47
48
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 44

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.



16
17
18
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 16

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.



24
25
26
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 24

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.



32
33
34
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 32

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)


74
75
76
77
78
79
80
81
82
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 74

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)


55
56
57
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 55

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)


64
65
66
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb', line 64

def without_arguments?
  !with_arguments?
end