class String
Extends class String
with methods for using Pastel-Methods
Converts string with config-Data (json-format) to nice output.
Extends String-class with the ability to check whether JSON-items with Hodmin-CFG-data within self-string includes given string. Compares two strings as Hashes: if key/values from str are included in self: TRUE, otherwise FALSE
Public Instance Methods
config_from_string()
click to toggle source
# File lib/hodmin/hodmin_pull_config.rb, line 25 def config_from_string return '' if strip.empty? JSON.parse(self).to_yaml end
include_cfg?(str)
click to toggle source
# File lib/hodmin/hodmin_tools.rb, line 382 def include_cfg?(str) return false if self == '' || str == '' h1 = JSON.parse(self) h2 = JSON.parse(str) (h2.to_a - h1.to_a).empty? end
setup_header()
click to toggle source
# File lib/hodmin/hodmin_list.rb, line 54 def setup_header pastel = Pastel.new case slice(0, 2) when 'HD' then pastel.white(gsub(/HD./, '')) when 'FW' then pastel.white(gsub(/FW./, '')) else gsub(/AD./, '') end end