Module: System::Collections::ConverterLambdas

Extended by:
ConverterLambdas
Included in:
ConverterLambdas, F
Defined in:
lib/raskell/f.rb

Instance Method Summary collapse

Instance Method Details

#from_stream(*args) ⇒ Object



1183
1184
1185
1186
1187
1188
1189
# File 'lib/raskell/f.rb', line 1183

def from_stream(*args)
  if args.length > 0
    FromStream.new().(*args)
  else
    FromStream.new()
  end
end

#lines_from_fileObject



1191
1192
1193
1194
1195
# File 'lib/raskell/f.rb', line 1191

def lines_from_file
  @@lines_from_file||= ->(filepath, options={}) {
    (options['separator'] ? IO.foreach(filepath, options['separator']) : IO.foreach(filepath)  ).to_stream
  }
end

#to_aObject



1209
1210
1211
# File 'lib/raskell/f.rb', line 1209

def to_a
  self.to_array
end

#to_arrayObject



1197
1198
1199
# File 'lib/raskell/f.rb', line 1197

def to_array
  FromStream.new(Array)
end

#to_hObject



1213
1214
1215
# File 'lib/raskell/f.rb', line 1213

def to_h
  self.to_hash
end

#to_hashObject



1201
1202
1203
# File 'lib/raskell/f.rb', line 1201

def to_hash
  FromStream.new(Hash)
end

#to_setObject



1205
1206
1207
# File 'lib/raskell/f.rb', line 1205

def to_set
  FromStream.new(Set)
end

#to_streamObject



1179
1180
1181
# File 'lib/raskell/f.rb', line 1179

def to_stream
  @@to_stream||= ->(xs) { xs.to_stream }
end