Class: CreateFiles
- Inherits:
-
Object
- Object
- CreateFiles
- Defined in:
- lib/tbr/create_files.rb
Constant Summary collapse
- ROW_COLOUR_ODD =
"EBD6D6"- ROW_COLOUR_EVEN =
"FFFFFF"- ROW_COLOUR_HEAD =
"D6ADAD"- UCB_GREEN =
"666633"- UCB_RED =
"993333"
Instance Attribute Summary collapse
-
#dir_root ⇒ Object
readonly
Header for each phone service.
-
#invoice_month ⇒ Object
readonly
Header for each phone service.
-
#logo ⇒ Object
Returns the value of attribute logo.
Instance Method Summary collapse
- #call_details(service) ⇒ Object
- #cost_centre_totals(cost_centres) ⇒ Object
- #dir_full_root ⇒ Object
- #group_summary(group) ⇒ Object
-
#initialize(invoice_date, dir_out, replace) ⇒ CreateFiles
constructor
A new instance of CreateFiles.
- #service_totals(services) ⇒ Object
Constructor Details
#initialize(invoice_date, dir_out, replace) ⇒ CreateFiles
Returns a new instance of CreateFiles.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tbr/create_files.rb', line 16 def initialize(invoice_date,dir_out,replace) @invoice_month = Time.parse(invoice_date).strftime('%B %Y') @dir_root = "#{dir_out || '/tmp'}/#{invoice_date[0..5]}" @dir_summaries = "#{@dir_root}/summaries" @dir_details = "#{@dir_root}/details" @logo = Tbr::Processor::LOGO_DEFAULT FileUtils.rm_rf(@dir_root) if replace if File.exist?(@dir_root) = "Output directory #{dir_full_root} already exists." Tbr.log.fatal() raise IOError, end Dir.mkdir(@dir_root) Dir.mkdir(@dir_summaries) Dir.mkdir(@dir_details) end |
Instance Attribute Details
#dir_root ⇒ Object (readonly)
Header for each phone service
13 14 15 |
# File 'lib/tbr/create_files.rb', line 13 def dir_root @dir_root end |
#invoice_month ⇒ Object (readonly)
Header for each phone service
13 14 15 |
# File 'lib/tbr/create_files.rb', line 13 def invoice_month @invoice_month end |
#logo ⇒ Object
Returns the value of attribute logo.
14 15 16 |
# File 'lib/tbr/create_files.rb', line 14 def logo @logo end |
Instance Method Details
#call_details(service) ⇒ Object
39 40 41 |
# File 'lib/tbr/create_files.rb', line 39 def call_details(service) create_call_details(service) end |
#cost_centre_totals(cost_centres) ⇒ Object
43 44 45 |
# File 'lib/tbr/create_files.rb', line 43 def cost_centre_totals(cost_centres) create_cost_centre_totals(cost_centres.sort) end |
#dir_full_root ⇒ Object
51 52 53 |
# File 'lib/tbr/create_files.rb', line 51 def dir_full_root File.realdirpath(@dir_root) end |
#group_summary(group) ⇒ Object
35 36 37 |
# File 'lib/tbr/create_files.rb', line 35 def group_summary(group) create_group_summary(group) end |
#service_totals(services) ⇒ Object
47 48 49 |
# File 'lib/tbr/create_files.rb', line 47 def service_totals(services) create_service_totals(services) end |