Class: ConvenientService::Support::Arguments Private
- Inherits:
-
Object
- Object
- ConvenientService::Support::Arguments
- Defined in:
- lib/convenient_service/support/arguments.rb,
lib/convenient_service/support/arguments/exceptions.rb,
lib/convenient_service/support/arguments/null_arguments.rb,
lib/convenient_service/support/arguments/null_arguments/exceptions.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Defined Under Namespace
Modules: Exceptions Classes: NullArguments
Instance Attribute Summary collapse
- #args ⇒ Object readonly private
- #block ⇒ Object private
- #kwargs ⇒ Object readonly private
Class Method Summary collapse
- .null_arguments ⇒ ConvenientService::Support::Arguments::NullArguments (also: nil_arguments) private
Instance Method Summary collapse
- #==(other) ⇒ Boolean private
-
#[](key) ⇒ Object
private
Can be any type.
- #any? ⇒ Booleam private
- #deconstruct ⇒ Array
- #deconstruct_keys(keys) ⇒ Hash
- #initialize(*args, **kwargs, &block) ⇒ void constructor private
- #none? ⇒ Booleam private
- #null_arguments? ⇒ Boolean (also: #nil_arguments?) private
- #to_arguments ⇒ ConvenientService::Support::Arguments private
Constructor Details
#initialize(*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.
44 45 46 47 48 |
# File 'lib/convenient_service/support/arguments.rb', line 44 def initialize(*args, **kwargs, &block) @args = args @kwargs = kwargs @block = block end |
Instance Attribute Details
#args ⇒ Object (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.
18 19 20 |
# File 'lib/convenient_service/support/arguments.rb', line 18 def args @args end |
#block ⇒ Object
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.
30 31 32 |
# File 'lib/convenient_service/support/arguments.rb', line 30 def block @block end |
#kwargs ⇒ Object (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/support/arguments.rb', line 24 def kwargs @kwargs end |
Class Method Details
.null_arguments ⇒ ConvenientService::Support::Arguments::NullArguments Also known as: nil_arguments
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.
54 55 56 |
# File 'lib/convenient_service/support/arguments.rb', line 54 def null_arguments @null_arguments ||= Support::Arguments::NullArguments.new 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.
113 114 115 116 117 118 119 120 121 |
# File 'lib/convenient_service/support/arguments.rb', line 113 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 |
#[](key) ⇒ Object
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 Can be any type.
101 102 103 104 105 106 107 |
# File 'lib/convenient_service/support/arguments.rb', line 101 def [](key) case key when Integer then args[key] when Symbol then kwargs[key] else ::ConvenientService.raise Exceptions::InvalidKeyType.new(key: key) end end |
#any? ⇒ 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.
79 80 81 82 83 84 85 |
# File 'lib/convenient_service/support/arguments.rb', line 79 def any? return true if args.any? return true if kwargs.any? return true if block false end |
#deconstruct ⇒ Array
Expected to be called only from pattern matching. Avoid direct usage of this method.
130 131 132 |
# File 'lib/convenient_service/support/arguments.rb', line 130 def deconstruct [args, kwargs, block] end |
#deconstruct_keys(keys) ⇒ Hash
Expected to be called only from pattern matching. Avoid direct usage of this method.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/convenient_service/support/arguments.rb', line 142 def deconstruct_keys(keys) keys ||= [:args, :kwargs, :block] keys.each_with_object({}) do |key, hash| case key when :args hash[key] = args when :kwargs hash[key] = kwargs when :block hash[key] = block end end end |
#none? ⇒ 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.
90 91 92 |
# File 'lib/convenient_service/support/arguments.rb', line 90 def none? !any? end |
#null_arguments? ⇒ Boolean Also known as: nil_arguments?
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.
67 68 69 |
# File 'lib/convenient_service/support/arguments.rb', line 67 def null_arguments? false end |
#to_arguments ⇒ ConvenientService::Support::Arguments
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.
160 161 162 |
# File 'lib/convenient_service/support/arguments.rb', line 160 def to_arguments self end |