Class: RIO::Ext::YAML::Tie::Doc
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(fn) ⇒ Doc
Returns a new instance of Doc.
33
34
35
36
37
38
|
# File 'lib/rio/ext/yaml/tie.rb', line 33
def initialize(fn)
@filename = fn
@io = nil
@doc = nil
@root = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
57
58
59
|
# File 'lib/rio/ext/yaml/tie.rb', line 57
def method_missing(sym,*args)
@root.__send__(sym,*args)
end
|
Class Method Details
.new_node(doc, cont) ⇒ Object
60
61
|
# File 'lib/rio/ext/yaml/tie.rb', line 60
def self.new_node(doc,cont)
end
|
Instance Method Details
46
47
48
49
50
51
52
53
|
# File 'lib/rio/ext/yaml/tie.rb', line 46
def close()
if @root.dirty?
@io.close
::File.open('database.yml',"w") do |ios|
::YAML.dump(@doc,ios)
end
end
end
|
39
40
41
42
43
44
|
# File 'lib/rio/ext/yaml/tie.rb', line 39
def open()
@io = ::File.new('database.yml',"r")
@doc = ::YAML.load(@io)
@root = RIO::Ext::YAML::Tie::Root.new(@doc)
self
end
|