Class: ConvenientService::Support::Arguments

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/support/arguments.rb,
lib/convenient_service/support/arguments/null_arguments.rb

Direct Known Subclasses

NullArguments

Defined Under Namespace

Classes: NullArguments

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, **kwargs, &block) ⇒ void

Parameters:

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


32
33
34
35
36
# File 'lib/convenient_service/support/arguments.rb', line 32

def initialize(*args, **kwargs, &block)
  @args = args
  @kwargs = kwargs
  @block = block
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



12
13
14
# File 'lib/convenient_service/support/arguments.rb', line 12

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



24
25
26
# File 'lib/convenient_service/support/arguments.rb', line 24

def block
  @block
end

#kwargsObject (readonly)

Returns the value of attribute kwargs.



18
19
20
# File 'lib/convenient_service/support/arguments.rb', line 18

def kwargs
  @kwargs
end

Class Method Details

.null_argumentsConvenientService::Support::Arguments::NullArguments



42
43
44
# File 'lib/convenient_service/support/arguments.rb', line 42

def null_arguments
  @null_arguments ||= Support::Arguments::NullArguments.new
end

Instance Method Details

#==(other) ⇒ Boolean

Parameters:

  • other (Object)

Returns:

  • (Boolean)


76
77
78
79
80
81
82
83
84
# File 'lib/convenient_service/support/arguments.rb', line 76

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

  return false if args != other.args
  return false if kwargs != other.kwargs
  return false if block != other.block

  true
end

#any?Booleam

Returns:

  • (Booleam)


57
58
59
60
61
62
63
# File 'lib/convenient_service/support/arguments.rb', line 57

def any?
  return true if args.any?
  return true if kwargs.any?
  return true if block

  false
end

#none?Booleam

Returns:

  • (Booleam)


68
69
70
# File 'lib/convenient_service/support/arguments.rb', line 68

def none?
  !any?
end

#null_arguments?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/convenient_service/support/arguments.rb', line 50

def null_arguments?
  false
end