Class: TextOutput

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

Instance Method Summary collapse

Instance Method Details

#out(hash) ⇒ Object



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

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


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

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


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

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