Module: LedgerSync::Util::Mixins::DelegateIterableMethodsMixin::ClassMethods

Defined in:
lib/ledger_sync/util/mixins/delegate_iterable_methods_mixin.rb

Constant Summary collapse

SHARED_METHODS =
%i[
  []
  any?
  count
  each
  empty?
  include?
  map
].freeze
ARRAY_METHODS =
(SHARED_METHODS | %i[]).freeze
HASH_METHODS =
(SHARED_METHODS | %i[
  each_key
  each_value
  fetch
  key?
  keys
  values
]).freeze

Instance Method Summary collapse

Instance Method Details

#delegate_array_methods_to(delegate_to) ⇒ Object



29
30
31
# File 'lib/ledger_sync/util/mixins/delegate_iterable_methods_mixin.rb', line 29

def delegate_array_methods_to(delegate_to)
  delegate(*ARRAY_METHODS, to: delegate_to)
end

#delegate_hash_methods_to(delegate_to) ⇒ Object



33
34
35
# File 'lib/ledger_sync/util/mixins/delegate_iterable_methods_mixin.rb', line 33

def delegate_hash_methods_to(delegate_to)
  delegate(*HASH_METHODS, to: delegate_to)
end