Class: SAFT::V2::HTML::SaftRenderer
- Inherits:
-
Tubby::Renderer
- Object
- Tubby::Renderer
- SAFT::V2::HTML::SaftRenderer
- Defined in:
- lib/saft/v2/html.rb
Instance Method Summary collapse
- #<<(obj) ⇒ Object
- #a(*args, **kwargs, &block) ⇒ Object
- #audit_file=(audit_file) ⇒ Object
- #get_account(id) ⇒ Object
- #get_analysis(id, type) ⇒ Object
- #get_customer(id) ⇒ Object
- #get_supplier(id) ⇒ Object
Instance Method Details
#<<(obj) ⇒ Object
625 626 627 628 629 630 631 632 633 634 |
# File 'lib/saft/v2/html.rb', line 625 def <<(obj) obj = obj.to_tubby if obj.respond_to?(:to_tubby) if obj.is_a?(Tubby::Template) obj.render_with(self) else @target << CGI.escape_html(obj.to_s) end self end |
#a(*args, **kwargs, &block) ⇒ Object
670 671 672 673 674 |
# File 'lib/saft/v2/html.rb', line 670 def a(*args, **kwargs, &block) kwargs[:class] ||= "" kwargs[:class] += " whitespace-pre underline underline-offset-1 hover:underline-offset-2 visited:underline-decoration-2" super(*args, **kwargs, &block) end |
#audit_file=(audit_file) ⇒ Object
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 |
# File 'lib/saft/v2/html.rb', line 636 def audit_file=(audit_file) (audit_file.master_files&.analysis_type_table || []) .each_with_object({}) { _2[[_1.analysis_id, _1.analysis_type]] = Analysis.new(_1) } .tap { @analysis_lookup = _1 } (audit_file.master_files&.customers || []) .each_with_object({}) { _2[_1.customer_id] = Customer.new(_1) } .tap { @customer_lookup = _1 } (audit_file.master_files&.suppliers || []) .each_with_object({}) { _2[_1.supplier_id] = Supplier.new(_1) } .tap { @supplier_lookup = _1 } (audit_file.master_files&.general_ledger_accounts || []) .each_with_object({}) { _2[_1.account_id] = Account.new(_1) } .tap { @account_lookup = _1 } end |
#get_account(id) ⇒ Object
658 659 660 |
# File 'lib/saft/v2/html.rb', line 658 def get_account(id) @account_lookup.fetch(id) { NotFoundAccount.instance } end |
#get_analysis(id, type) ⇒ Object
654 655 656 |
# File 'lib/saft/v2/html.rb', line 654 def get_analysis(id, type) @analysis_lookup.fetch([id, type]) { NotFoundAnalysys.instance } end |
#get_customer(id) ⇒ Object
662 663 664 |
# File 'lib/saft/v2/html.rb', line 662 def get_customer(id) @customer_lookup.fetch(id) { NotFoundCustomer.instance } end |
#get_supplier(id) ⇒ Object
666 667 668 |
# File 'lib/saft/v2/html.rb', line 666 def get_supplier(id) @supplier_lookup.fetch(id) { NotFoundSupplier.instance } end |