Class: Avmtrf1::InventarioSistemas::SiteBuild::Sistema

Inherits:
HtmlPageBase
  • Object
show all
Defined in:
lib/avmtrf1/inventario_sistemas/site_build/sistema.rb

Constant Summary

Constants inherited from HtmlPageBase

HtmlPageBase::NAVBAR_SEPARATOR, HtmlPageBase::SITE_TITLE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HtmlPageBase

#build, #href, #output_path, #site_title, #uid

Constructor Details

#initialize(site, parent, raw_row) ⇒ Sistema

Returns a new instance of Sistema.



13
14
15
16
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 13

def initialize(site, parent, raw_row)
  super(site, parent)
  @raw_row = raw_row
end

Instance Attribute Details

#raw_rowObject (readonly)

Returns the value of attribute raw_row.



11
12
13
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 11

def raw_row
  @raw_row
end

Instance Method Details

#column_value(main, sub = nil) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 49

def column_value(main, sub = nil)
  column = if main.is_a?(::Avmtrf1::InventarioSistemas::Parser::HeaderColumn)
             main
           else
             site.column(main, sub)
           end
  raise 'Out of bound' if column.index >= raw_row.count

  raw_row[column.index]
end

#gestorObject



22
23
24
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 22

def gestor
  column_value('gestor na jf1', 'unidade')
end

#idObject



18
19
20
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 18

def id
  nome.parameterize
end

#nomeObject



26
27
28
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 26

def nome
  column_value('sistema', 'sigla')
end

#output_inner_contentObject



40
41
42
43
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 40

def output_inner_content
  column_values = site.parser.header_columns.map { |c| [c.key, column_value(c)] }
  '<h3>Detalhes</h3>' + html_table(%w[Campo Valor], column_values)
end

#producaoObject



30
31
32
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 30

def producao
  html_linkfy(column_value('ambientes', 'produção – serv. ap'))
end

#responsavelObject



34
35
36
37
38
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 34

def responsavel
  %w[unidade seção nome]
    .map { |sub| column_value('responsável pelo desenvolvimento', sub) }
    .reject(&:blank?).join(' » ')
end

#titleObject



45
46
47
# File 'lib/avmtrf1/inventario_sistemas/site_build/sistema.rb', line 45

def title
  nome
end