lib/pass_station/output.rb in pass-station-1.2.2 vs lib/pass_station/output.rb in pass-station-1.2.3
- old
+ new
@@ -50,11 +50,11 @@
x.gsub(rgxp) { |s| Paint[s, :red] }
end
end
# Normalize string to be class name compatible
- # Join splitted words and capitalize
+ # Join split words and capitalize
# @param formatter [String] formatter name
# @return [String] normalized name (class compatible)
def normalize(formatter)
formatter.split('-').map(&:capitalize).join
end
@@ -103,15 +103,14 @@
# values are shorter than headers and breaks the table display)
# @param colsizes [Hash] hash containing the column size for each column as returned by {colsizes_count}
# @return [Hash] fixed colsizes, keys are columns name, values are columns size
def correct_min_colsizes(colsizes)
min_colsizes = {
- productvendor: 14,
- username: 9,
- password: 9
+ productvendor: 14, username: 9, password: 9, modelsoftware_name: 19,
+ version: 8, access_type: 12, privileges: 11, notes: 6, vendor: 7
}
- min_colsizes.each_with_object({}) { |(k, v), h| h[k] = [v, colsizes[k]].max }
+ colsizes.each_with_object({}) { |(k, v), h| h[k] = [v, min_colsizes[k]].max }
end
# Left justify an element of the column
# @param row [CSV::Row] +CSV::Row+
# @param column [Symbol] the symbol of the column
@@ -218,11 +217,11 @@
class << self
# Format the +Array<CSV::Row>+ into JSON
# @param table [Array<CSV::Row>] an +Array<CSV::Row>+
# @return [Array<String>] the formatted JSON ready to be printed (only
# one element on the array, keep an array for compatibility with
- # {highlight_found} and homogeneity with other formatters)
+ # {DB.highlight_found} and homogeneity with other formatters)
def format(table)
[table.map(&:to_h).to_json]
end
end
end
@@ -232,10 +231,10 @@
class << self
# Format the +Array<CSV::Row>+ into YAML
# @param table [Array<CSV::Row>] an +Array<CSV::Row>+
# @return [Array<String>] the formatted YAML ready to be printed (only
# one element on the array, keep an array for compatibility with
- # {highlight_found} and homogeneity with other formatters)
+ # {DB.highlight_found} and homogeneity with other formatters)
def format(table)
[table.map(&:to_h).to_yaml]
end
end
end