Class: Aio::Ui::ReadableText

Inherits:
Object
  • Object
show all
Defined in:
lib/aio/ui/readable_text.rb

Constant Summary collapse

DefaultIndent =
2

Class Method Summary collapse

Class Method Details

.dump_module_cmds(mods, h = nil, indent = DefaultIndent) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/aio/ui/readable_text.rb', line 9

def dump_module_cmds(mods, h=nil, indent=DefaultIndent)
	col = ["cmd name", "ranking", "device", "description"]
	table = Aio::Base::Toolkit::Table.new(
		'Header'	=> h ||= 'Aio CMD Modules',
		'Indent'	=> indent,
		'Columns'	=> col,
		'CellPad'	=> 2,
		'SortIndex'	=> 2)

	# info => { :module_type,
	# 					:module_layer_2
	#						:full_path
	#    				:klass
	mods.each_pair do |mod_name, info|
		row = []
		row << info[:klass].cmd_full
		row << info[:klass].ranking.to_s
		row << info[:module_layer_2]
		row << info[:klass].description
		table << row
	end

	table.to_s + "\n"
end

.dump_module_inputs(mods, h = nil, indent = DefaultIndent) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/aio/ui/readable_text.rb', line 34

def dump_module_inputs(mods, h=nil, indent=DefaultIndent)
	col = ["input style", "platform", "description"]
	table = Aio::Base::Toolkit::Table.new(
		'Header'		=> h || "Aio Input Modules",
		'Indent'		=> indent,
		'Columns'		=> col,
		'CellPad'		=> 2)

	mods.each_pair do |mod_name, info|
		row = []
		row << mod_name
		row << info[:klass].platform
		row << info[:klass].description
		table << row
	end

	table.to_s + "\n"
end

.dump_module_outputs(mods, h = nil, indent = DefaultIndent) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/aio/ui/readable_text.rb', line 53

def dump_module_outputs(mods, h=nil, indent=DefaultIndent)
	col = ["output style", "suffix", "description"]
	table = Aio::Base::Toolkit::Table.new(
		'Header'		=> h || "Aio Output Modules",
		'Indent'		=> indent,
		'Columns'		=> col,
		'CellPad'		=> 2)

	mods.each_pair do |mod_name, info|
		row = []
		row << mod_name
		row << info[:klass].file_suffix
		row << info[:klass].description
		table << row
	end

	table.to_s + "\n"
end