Class: RIO::Ext::YAML::Tie::Doc
- Inherits:
-
Object
- Object
- RIO::Ext::YAML::Tie::Doc
show all
- Extended by:
- Forwardable
- Defined in:
- lib/rio/ext/yaml/tie.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(fn) ⇒ Doc
Returns a new instance of Doc.
47
48
49
50
51
52
|
# File 'lib/rio/ext/yaml/tie.rb', line 47
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
70
71
72
|
# File 'lib/rio/ext/yaml/tie.rb', line 70
def method_missing(sym,*args)
@root.__send__(sym,*args)
end
|
Class Method Details
.new_node(doc, cont) ⇒ Object
73
74
|
# File 'lib/rio/ext/yaml/tie.rb', line 73
def self.new_node(doc,cont)
end
|
Instance Method Details
60
61
62
63
64
65
66
67
|
# File 'lib/rio/ext/yaml/tie.rb', line 60
def close()
if @root.dirty?
@io.close
::File.open('database.yml',"w") do |ios|
::YAML.dump(@doc,ios)
end
end
end
|
53
54
55
56
57
58
|
# File 'lib/rio/ext/yaml/tie.rb', line 53
def open()
@io = ::File.new('database.yml',"r")
@doc = ::YAML.load(@io)
@root = RIO::Ext::YAML::Tie::Root.new(@doc)
self
end
|