Class: TextOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/outputs.rb

Instance Method Summary collapse

Instance Method Details

#out(hash) ⇒ Object



3
4
5
6
7
# File 'lib/outputs.rb', line 3

def out(hash)
  hash.each_pair do |k,v|
	print(k, k, v) if v != nil
  end
end


9
10
11
12
13
14
15
# File 'lib/outputs.rb', line 9

def print(parent_key, k, v)
	if v.is_a?(Hash)
		print_hash(k, v)
	else
		puts k + ": " + v.to_s
	end
end


17
18
19
20
21
# File 'lib/outputs.rb', line 17

def print_hash(parent_key, hash)
	hash.each_pair do |k,v|
		print parent_key + "." + k, k, v if v != nil
	end
end