lib/rbbt/tsv/accessor.rb in rbbt-util-5.25.33 vs lib/rbbt/tsv/accessor.rb in rbbt-util-5.25.34
- old
+ new
@@ -670,18 +670,31 @@
rescue
end
peek
end
- def head(times=10)
+ def head_str(times=10)
stream = dumper_stream
str = ""
times.times do |i|
break if stream.eof?
str << stream.gets
end
str
end
+
+ def head_tsv(times = 10)
+ new = self.annotate({})
+ i = 0
+ self.each do |k,v|
+ return new if i == times
+ new[k] = v
+ i += 1
+ end
+ new
+ end
+
+ alias head head_tsv
def summary
key = nil
values = nil