Module: Fast

Defined in:
lib/fast/dir.rb,
lib/fast/fast.rb,
lib/fast/file.rb,
lib/fast/version.rb,
lib/fast/dir-filter.rb,
lib/fast/file-filter.rb

Defined Under Namespace

Classes: Dir, DirFilter, File, FileFilter

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.dir(path = nil) ⇒ Object

Returns a Dir with the file list already called (if a path is provided)



3
4
5
6
7
8
9
10
# File 'lib/fast/fast.rb', line 3

def self.dir path = nil
  unless path.nil?
    the_dir = Fast::Dir.new path
    the_dir.list
  else 
    Fast::Dir.new
  end
end

.dir!(path) ⇒ Object

Like ‘dir`, but creates the directory if it does not exist



13
14
15
# File 'lib/fast/fast.rb', line 13

def self.dir! path
  Dir.new.create( path ).list
end

.dir?(path) ⇒ Boolean

Returns true if a directory named ‘path` exists, false otherwise. (wrapper for `File.directory? <path>`)

Returns:

  • (Boolean)


34
35
36
# File 'lib/fast/fast.rb', line 34

def self.dir? path  
  Dir.new.exist? path
end

.file(path = nil) ⇒ Object

Returns a File with its content (if a path to a valid file is provided)



18
19
20
21
22
23
24
25
# File 'lib/fast/fast.rb', line 18

def self.file path = nil
  if path
    the_file = Fast::File.new path 
    the_file.read
  else 
    Fast::File.new
  end
end

.file!(path) ⇒ Object

Returns a File, and creates it if is does not exist



28
29
30
# File 'lib/fast/fast.rb', line 28

def self.file! path
  File.new.create path
end

.file?(path) ⇒ Boolean

Example. This all will be deprecated when features are done

Returns:

  • (Boolean)


39
40
41
# File 'lib/fast/fast.rb', line 39

def self.file? path
  File.new.exist? path
end