Module: SAFT::V2::HTML

Defined in:
lib/saft/v2/html.rb

Defined Under Namespace

Modules: DryStructRenderTubby Classes: Account, Analysis, AnalysisTypeTable, CompanyCard, Customer, LinesTable, NotFoundAccount, NotFoundAnalysys, NotFoundCustomer, NotFoundSupplier, RenderGeneralLedgerTable, RenderHash, SaftRenderer, Supplier, TaxTable

Class Method Summary collapse

Class Method Details

.cssObject



8
9
10
# File 'lib/saft/v2/html.rb', line 8

def self.css
  File.read(css_path)
end

.css_pathObject



12
13
14
# File 'lib/saft/v2/html.rb', line 12

def self.css_path
  Pathname.new(__dir__) + "html_dist.css"
end

.format_big_decimal(big_decimal) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/saft/v2/html.rb', line 16

def self.format_big_decimal(big_decimal)
  negative = big_decimal.negative?
  integer, decimal = big_decimal.abs.to_s("F").split(".")
  integer = integer.reverse.scan(/.{1,3}/).join(" ").reverse

  "#{negative ? "-" : ""}#{integer},#{decimal.ljust(2, "0")}"
end

.render(audit_file) ⇒ Object



677
678
679
680
681
682
683
684
# File 'lib/saft/v2/html.rb', line 677

def self.render(audit_file)
  target = +""
  renderer = SaftRenderer.new(target)
  renderer.audit_file = audit_file
  renderer << audit_file

  Tubby.new { |t| t.raw!(target) }
end