Module: IMW::Schemes::HDFSFile
- Defined in:
- lib/imw/schemes/hdfs.rb
Overview
Defines methods for reading data from HDFS files.
Instance Method Summary collapse
-
#each {|String| ... } ⇒ Object
Iterate through each line of this HDFS resource.
-
#io ⇒ StringIO
Return a handle on a StringIO object representing the content in this HDFS file.
-
#map {|String| ... } ⇒ Array
Map over the lines of this HDFS resource.
-
#read ⇒ String
Return the contents of this HDFS file as a string.
Instance Method Details
#each {|String| ... } ⇒ Object
Iterate through each line of this HDFS resource.
184 185 186 |
# File 'lib/imw/schemes/hdfs.rb', line 184 def each &block HDFS.fs(:cat, path, &block) end |
#io ⇒ StringIO
Return a handle on a StringIO object representing the content in this HDFS file.
Be VERY careful how you use this! It is a StringIO object so the whole HDFS file is read into a string before returning the handle.
196 197 198 |
# File 'lib/imw/schemes/hdfs.rb', line 196 def io @io ||= StringIO.new(read) end |