lib/imw/schemes/hdfs.rb in imw-0.2.17 vs lib/imw/schemes/hdfs.rb in imw-0.2.18
- old
+ new
@@ -200,11 +200,11 @@
# Map over the lines of this HDFS resource.
#
# @yield [String] each line of the file
# @return [Array] the result of the block on each line
def map &block
- returning([]) do |output|
+ [].tap do |output|
HDFS.fs(:cat, path) do |line|
output << block.call(line)
end
end
end
@@ -217,10 +217,10 @@
# Return the paths of all files and directories directly below
# this directory on the HDFS.
#
# @return [Array<String>]
def contents
- returning([]) do |paths|
+ [].tap do |paths|
HDFS.fs(:ls, path) do |line|
next if line =~ /^Found.*items$/
paths << line.split.last
end
end