Class: Translatomatic::Config::Display

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/translatomatic/config/display.rb

Overview

Methods for displaying configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Display

Returns a new instance of Display.



7
8
9
10
11
# File 'lib/translatomatic/config/display.rb', line 7

def initialize(opts = {})
  @options = opts
  @config_params = opts[:config_params]
  raise t('config.one_at_a_time') if opts[:user] && opts[:project]
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/translatomatic/config/display.rb', line 5

def options
  @options
end

Instance Method Details

#config_table_bodyArray<Array<String>>

Returns Configuration table.

Returns:

  • (Array<Array<String>>)

    Configuration table



14
15
16
17
18
19
20
21
22
# File 'lib/translatomatic/config/display.rb', line 14

def config_table_body
  columns = options[:columns] || []
  rows = config_table_rows(columns)
  if rows.present?
    headings = columns.collect { |i| CONFIG_HEADING_MAP[i] }
    rows = add_table_heading(rows, headings)
  end
  rows
end