Class: Ciphr::Functions::Reader::FileReader

Inherits:
Function
  • Object
show all
Defined in:
lib/ciphr/functions/reader.rb

Instance Attribute Summary

Attributes inherited from Function

#args, #options

Instance Method Summary collapse

Methods inherited from Function

aligned, inherited, #initialize, invertable?, params, #prepend, #read, variants

Constructor Details

This class inherits a constructor from Ciphr::Functions::Function

Instance Method Details

#applyObject



26
27
28
29
30
31
32
33
34
# File 'lib/ciphr/functions/reader.rb', line 26

def apply
  f = File.open(options[:file], "r")
  f.binmode
  Proc.new do
    chunk = f.read(256)
    f.close if ! chunk
    chunk
  end
end