Class: Nameday::VvcPdfExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/nameday_vvc_pdf_extractor.rb

Constant Summary collapse

EMPTY_NAMEDAY_REGEXP =

Unicode category “Punctuation: Dash”

/\p{Pd}/
TEXT_ROW_DELIMITER =
"\n"
MONTH_NAMES =
%w[
  -
  JANVĀRIS
  FEBRUĀRIS
  MARTS
  APRĪLIS
  MAIJS
  JŪNIJS
  JŪLIJS
  AUGUSTS
  SEPTEMBRIS
  OKTOBRIS
  NOVEMBRIS
  DECEMBRIS
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVvcPdfExtractor

Returns a new instance of VvcPdfExtractor.



28
29
30
# File 'lib/nameday_vvc_pdf_extractor.rb', line 28

def initialize
  @output = {}
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



26
27
28
# File 'lib/nameday_vvc_pdf_extractor.rb', line 26

def output
  @output
end

Instance Method Details

#extractObject



36
37
38
39
40
# File 'lib/nameday_vvc_pdf_extractor.rb', line 36

def extract
  raise("PDF not opened!") unless @pdf_reader
  process_pdf
  output
end

#read_pdf(file_name) ⇒ Object



32
33
34
# File 'lib/nameday_vvc_pdf_extractor.rb', line 32

def read_pdf(file_name)
  @pdf_reader = ::PDF::Reader.new(file_name)
end