Class: AchClient::Helpers::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/ach_client/helpers/utils.rb

Class Method Summary collapse

Class Method Details

.hashlist_merge(hashlist) ⇒ Object

Given a list of hashes where the hashes values are lists, merge the

list of hashes by appending the two lists when there is a key
collision

Parameters:

  • hashlist (Array(Hash{String => Array}))


8
9
10
11
12
13
14
# File 'lib/ach_client/helpers/utils.rb', line 8

def self.hashlist_merge(hashlist)
  hashlist.reduce do |map, record|
    map.merge(record) do |_key, left_value, right_value|
      left_value + right_value
    end
  end
end

.icheck_date_format(date_string) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/ach_client/helpers/utils.rb', line 16

def self.icheck_date_format(date_string)
  return unless date_string
  begin
    Date.strptime(date_string, "%m/%d/%Y")
  rescue Date::Error
    return date_string
  end
end