Module: ACH::StringFormattingHelper

Defined in:
lib/ach/string_formatting_helper.rb

Class Method Summary collapse

Class Method Details

.stringify_with_same_day(f) ⇒ Object

Passing in SD to the date signifies same-day to banks. This is used for the company_descriptive_date



5
6
7
8
9
10
11
12
13
# File 'lib/ach/string_formatting_helper.rb', line 5

def self.stringify_with_same_day(f)
  return f.upcase if f.to_s.upcase.match(/^SD\d+$/)

  if f.respond_to?(:strftime)
    f = f.strftime('%y%m%d')
  end

  f[0..5].rjust(6)
end