lib/psulib_traject/processors/pub_date.rb
def resolve_date(date_str)
      u_count = date_str.count 'u'
      # Replace unknown digits with 0.
      date = date_str.tr('u', '0').to_i
      if u_count.positive? && date != 0
        delta = 10**u_count # 10^u_count, exponent
        date + (delta / 2) if delta <= ESTIMATE_TOLERANCE
      elsif date != 0
        date
      end
    end
# Resolve single date u's means range, find midpoint and check tolerance
Resolve single date u's means range, find midpoint and check tolerance
Resolve single date u ' s means range find midpoint and check tolerance
def resolve_date(date_str)
      u_count = date_str.count 'u'
      date = date_str.tr('u', '0').to_i
      if u_count.positive? && date != 0
        delta = 10**u_count 
        date + (delta / 2) if delta <= ESTIMATE_TOLERANCE
      elsif date != 0
        date
      end
    end
def resolve_date ( date_str ) u_count = date_str . count 'u' date = date_str . tr ( 'u' , '0' ) . to_i if u_count . positive? && date != 0 delta = 10 ** u_count date + ( delta / 2 ) if delta <= ESTIMATE_TOLERANCE elsif date != 0 date end end
Resolve single date u's means range, find midpoint and check tolerance
Resolve single date u ' s means range find midpoint and check tolerance
# Replace unknown digits with 0. # 10^u_count, exponent
date_str