class Typingpool::Filer::Files
Handler for collection of Filer
instances. Makes them enumerable, Allows easy re-casting to Filer::Files
subclasses, and provides various other convenience methods.
Attributes
files[R]
Array of Filer
instances included in the collection
Public Class Methods
new(files)
click to toggle source
Constructor. Takes array of Filer
instances.
# File lib/typingpool/filer/files.rb, line 17 def initialize(files) @files = files end
Public Instance Methods
as(sym)
click to toggle source
Cast this collection into a new Filer::Files
subtype, e.g. Filer::Files::Audio
.
==== Params [sym] Symbol corresponding to Filer::Files subclass to cast into. For example, passing :audio will cast into a Filer::Files::Audio. ==== Returns Instance of new Filer::Files subclass
Calls superclass method
Typingpool::Utility::Castable#as
# File lib/typingpool/filer/files.rb, line 36 def as(sym) #super calls into Utility::Castable mixin super(sym, files) end
each() { |file| ... }
click to toggle source
Enumerate through Filer
instances.
# File lib/typingpool/filer/files.rb, line 22 def each files.each do |file| yield file end end
mv!(to)
click to toggle source
to_streams()
click to toggle source
Returns array of IO streams created by calling to_stream on each Filer
instance in the collection.
# File lib/typingpool/filer/files.rb, line 43 def to_streams self.map{|file| file.to_stream } end