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
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 readonly private
- #kwargs ⇒ Object readonly private
Class Method Summary collapse
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 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.
38 39 40 41 42 |
# File 'lib/convenient_service/support/arguments.rb', line 38 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 (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.
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
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.
48 49 50 |
# File 'lib/convenient_service/support/arguments.rb', line 48 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.
97 98 99 100 101 102 103 104 105 |
# File 'lib/convenient_service/support/arguments.rb', line 97 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.
85 86 87 88 89 90 91 |
# File 'lib/convenient_service/support/arguments.rb', line 85 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.
63 64 65 66 67 68 69 |
# File 'lib/convenient_service/support/arguments.rb', line 63 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.
114 115 116 |
# File 'lib/convenient_service/support/arguments.rb', line 114 def deconstruct [args, kwargs, block] end |
#deconstruct_keys(keys) ⇒ Hash
Expected to be called only from pattern matching. Avoid direct usage of this method.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/convenient_service/support/arguments.rb', line 126 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.
74 75 76 |
# File 'lib/convenient_service/support/arguments.rb', line 74 def none? !any? end |
#null_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.
56 57 58 |
# File 'lib/convenient_service/support/arguments.rb', line 56 def null_arguments? false end |