lib/rio/ext/yaml.rb in rio-0.3.9 vs lib/rio/ext/yaml.rb in rio-0.4.0
- old
+ new
@@ -52,10 +52,12 @@
cxx_('yaml',true)
end
protected :yaml_
def objects(*args) records(*args) end
def documents(*args) rows(*args) end
+ def object(*args) record(*args) end
+ def document(*args) row(*args) end
def skipobjects(*args) skiprecords(*args) end
def skipdocuments(*args) skiprows(*args) end
end
end
module YAML
@@ -83,20 +85,10 @@
YAML.dump(recs[0],ioarg)
else
YAML.dump(recs,ioarg)
end
end
- def cpto_obj_(arg)
- self.each { |obj|
-
- }
- end
- def cpto_array_(array)
- self.each { |el|
- array << el
- }
- end
def cpto_string_(string)
string << ::YAML.dump_stream(self.contents)
end
def get_(arg=nil)
case cx['stream_itertype']
@@ -120,49 +112,36 @@
end
def getobj()
getrec()
end
- def add_filters
- cx['yaml_close_eof'],cx['closeoneof'] = cx['closeoneof'],false
- super
- end
- def each_(&block)
- #old_close_eof,cx['closeoneof'] = cx['closeoneof'],false
- super
- cx['closeoneof'] = cx.delete('yaml_close_eof')
-
- if closeoneof?
- add_filter(Filter::CloseOnEOF)
- ioh.oncloseproc = proc { self.on_closeoneof }
- end
- closeoneof? ? ioh.close_on_eof_(self) : self
- end
end
end
module YAML
module Output
protected
def cpfrom_(arg)
- case arg
- #when ::Array then cpfrom_array_(arg)
- when Rio,::IO,::StringIO then super
- else self.put_(arg)
- end
- self
- end
- def cpfrom_array_(array)
- array.each { |el|
- self.put_(el)
- }
+ #p "yaml#cpfrom_(#{arg})"
+ case arg
+ #when ::Array then cpfrom_array_(arg)
+ when Rio,::IO,::StringIO then super
+ else self.put_(arg)
+ end
self
end
- def cpfrom_rio_(ario)
- ioh.puts(::YAML.dump_stream(*ario[]))
- self
- end
+# def cpfrom_array_(array)
+# array.each { |el|
+# self.put_(el)
+# }
+# self
+# end
+# def cpfrom_rio_(ario)
+# p "yaml#cpfrom_rio_(#{ario})"
+# ioh.puts(::YAML.dump_stream(*ario[]))
+# self
+# end
def put_(obj)
#p callstr('put_',obj)
ioh.puts(obj.to_yaml)
end