Class: SAFT::V2::HTML::AnalysisTypeTable

Inherits:
Object
  • Object
show all
Defined in:
lib/saft/v2/html.rb

Instance Method Summary collapse

Constructor Details

#initialize(analysis_type_table) ⇒ AnalysisTypeTable

Returns a new instance of AnalysisTypeTable.



363
364
365
# File 'lib/saft/v2/html.rb', line 363

def initialize(analysis_type_table)
  @analysis_type_table = analysis_type_table
end

Instance Method Details

#to_tubbyObject



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/saft/v2/html.rb', line 367

def to_tubby
  Tubby.new { |t|
    t.table {
      t.thead {
        t.tr {
          t.th("Type")
          t.th("Type description")
          t.th("ID")
          t.th("ID Description")
          t.th("Rest")
        }
      }
      t.tbody {
        @analysis_type_table.each { |entry|
          html_analysis = t.get_analysis(entry.analysis_id, entry.analysis_type)
          t.tr(id: html_analysis.html_id) {
            t.td(entry.analysis_type)
            t.td(entry.analysis_type_description)
            t.td(entry.analysis_id)
            t.td(entry.analysis_id_description)
            t.td(class: "pl-2") {
              t.div(class: "pl-2 border-l-2") {
                t <<
                  RenderHash.new(
                    entry
                      .attributes
                      .except(
                        :analysis_type,
                        :analysis_type_description,
                        :analysis_id,
                        :analysis_id_description,
                      ),
                  )
              }
            }
          }
        }
      }
    }
  }
end