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
-
.dir(path = nil) ⇒ Object
Returns a Dir with the file list already called (if a path is provided).
-
.dir!(path) ⇒ Object
Like ‘dir`, but creates the directory if it does not exist.
-
.dir?(path) ⇒ Boolean
Returns true if a directory named ‘path` exists, false otherwise.
-
.file(path = nil) ⇒ Object
Returns a File with its content (if a path to a valid file is provided).
-
.file!(path) ⇒ Object
Returns a File, and creates it if is does not exist.
-
.file?(path) ⇒ Boolean
Example.
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>`)
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 |