Class: Oat::OA

Inherits:
Object
  • Object
show all
Includes:
FileHandling
Defined in:
lib/oat/oa.rb

Instance Method Summary collapse

Methods included from FileHandling

#read_oa_data, #read_partial_templatable_file, #read_templatable_file

Constructor Details

#initialize(sourcefile, casenumber) ⇒ OA


20
21
22
23
24
25
26
# File 'lib/oat/oa.rb', line 20

def initialize(sourcefile, casenumber)
  @sourcefile = sourcefile
  @casenumber = casenumber
  read_oa_data

  determine_oa_type #set @oa with the correct object
end

Instance Method Details

#finish(options = {}) ⇒ Object

write out docx data to file


58
59
60
61
62
63
64
65
# File 'lib/oat/oa.rb', line 58

def finish(options = {})
  defaults = {  sablon: true
              }
  options = defaults.merge(options)

  stemplate = Sablon.template(@oa.template)
  stemplate.render_to_file Oat.configuration.outputfile, @oa.props
end

#outputfileObject


43
44
45
# File 'lib/oat/oa.rb', line 43

def outputfile
  Oat.configuration.outputfile
end

#outputfile=(filename) ⇒ Object


47
48
49
# File 'lib/oat/oa.rb', line 47

def outputfile=(filename)
  Oat.configuration.outputfile = filename
end

#read_reasons_file(r = File.join(Oat.txt_dir, 'reasons.yml')) ⇒ Object

require reason file, not included because of NDA


52
53
54
55
# File 'lib/oat/oa.rb', line 52

def read_reasons_file(r = File.join(Oat.txt_dir, 'reasons.yml'))
  @reasons = YAML.load_file(r)
  @oa.reasons = @reasons unless @oa.nil?
end

#scan(options = {}) ⇒ Object


28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/oat/oa.rb', line 28

def scan(options = {})
  defaults = { }
  options = defaults.merge(options)

  read_reasons_file
  read_templatable_file         #chunks of text for swapping
  read_partial_templatable_file #chunks of text for swapping

  Oat.configuration.casenumber = @casenumber
  
  #run scan on whatever type of document is in oa
  #which is set by set_oa_type
  @oa.scan 
end