Module: YAML

Defined in:
lib/tagen/yaml.rb

Overview

YAML.load(Pa('/tmp/a')) YAML.dump("x", Pa('/tmp/a'))

Class Method Summary collapse

Class Method Details

.dump(obj, path) ⇒ Object

add String, #path support

Parameters:



26
27
28
29
30
31
32
33
# File 'lib/tagen/yaml.rb', line 26

def dump obj, path
	if path.respond_to?(:path)
		path = path.path
		open(path, "w+"){|f| original_dump(obj, f)}
	else
		original_dump obj, path
	end
end

.load(path) ⇒ Object

add #path support

Parameters:



14
15
16
17
18
19
20
21
22
# File 'lib/tagen/yaml.rb', line 14

def load path
	if path.respond_to?(:path)
		path = path.path
		open(path){|f| original_load(f)}

	else
		original_load path
	end
end

.original_dumpObject



10
# File 'lib/tagen/yaml.rb', line 10

alias original_dump dump

.original_loadObject



9
# File 'lib/tagen/yaml.rb', line 9

alias original_load load