Class: Emendate::Translators::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/emendate/translators/abstract.rb

Overview

Abstract class defining the interface common to all translators

Instance Method Summary collapse

Instance Method Details

#translate(processed, pdate) ⇒ Object

Parameters:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/emendate/translators/abstract.rb', line 10

def translate(processed, pdate)
  @processed = processed
  @pdate = pdate
  @warnings = processed.warnings.flatten.uniq
  @base = nil
  @qualified = nil
  preprocess if respond_to?(:preprocess)

  translate_value
  TranslatedDate.new(
    orig: processed.orig_string,
    value: qualified || base,
    warnings: warnings
  )
end