Class: ConvenientService::Utils::Array::Merge
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Array::Merge
- Defined in:
- lib/convenient_service/utils/array/merge.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
-
#overrides ⇒ Object
readonly
Returns the value of attribute overrides.
-
#raise_on_non_integer_index ⇒ Object
readonly
Returns the value of attribute raise_on_non_integer_index.
Instance Method Summary collapse
Methods inherited from Support::Command
Constructor Details
#initialize(array, overrides, raise_on_non_integer_index: true) ⇒ void
31 32 33 34 35 |
# File 'lib/convenient_service/utils/array/merge.rb', line 31 def initialize(array, overrides, raise_on_non_integer_index: true) @array = array @overrides = overrides @raise_on_non_integer_index = raise_on_non_integer_index end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
11 12 13 |
# File 'lib/convenient_service/utils/array/merge.rb', line 11 def array @array end |
#overrides ⇒ Object (readonly)
Returns the value of attribute overrides.
17 18 19 |
# File 'lib/convenient_service/utils/array/merge.rb', line 17 def overrides @overrides end |
#raise_on_non_integer_index ⇒ Object (readonly)
Returns the value of attribute raise_on_non_integer_index.
23 24 25 |
# File 'lib/convenient_service/utils/array/merge.rb', line 23 def raise_on_non_integer_index @raise_on_non_integer_index end |
Instance Method Details
#call ⇒ Array
41 42 43 44 45 |
# File 'lib/convenient_service/utils/array/merge.rb', line 41 def call ensure_valid_overrides! integer_key_overrides.each_with_object(array.dup) { |(index, value), array| array[index] = value } end |