class YamlQuery::Output
Public Class Methods
display_results(file, results, options)
click to toggle source
# File lib/yamlquery/output.rb, line 6 def self.display_results(file, results, options) puts file if options[:onlyfile?] elsif options[:depth] gather_keys(results, options[:depth]) elsif options[:yaml?] puts Psych.dump(results) puts elsif options[:oneline?] p results puts else pp results puts end end
gather_keys(results, depth, index = 1)
click to toggle source
# File lib/yamlquery/output.rb, line 23 def self.gather_keys(results, depth, index = 1) if index == depth.to_i puts results.keys else results.each do |k, v| gather_keys(v, depth, index + 1) if v.is_a?(Hash) end end end
Public Instance Methods
flatten_results()
click to toggle source
# File lib/yamlquery/output.rb, line 2 def flatten_results # TODO end