Module: Fast
- Defined in:
- lib/fast/dir.rb,
lib/fast/fast.rb,
lib/fast/file.rb,
lib/fast/version.rb,
lib/fast/exceptions.rb,
lib/fast/filesystemobject.rb
Defined Under Namespace
Modules: FilesystemObject Classes: Dir, File, PathNotSettedException
Constant Summary collapse
- VERSION =
"0.1.4"
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)
9 10 11 12 13 14 15 16 17 |
# File 'lib/fast/fast.rb', line 9 def self.dir path = nil unless path.nil? the_dir = Fast::Dir.new path the_dir.list if the_dir.exist? the_dir else Fast::Dir.new end end |
.dir!(path) ⇒ Object
Like ‘dir`, but creates the directory if it does not exist
20 21 22 |
# File 'lib/fast/fast.rb', line 20 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>`)
42 43 44 |
# File 'lib/fast/fast.rb', line 42 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)
25 26 27 28 29 30 31 32 33 |
# File 'lib/fast/fast.rb', line 25 def self.file path = nil if path the_file = Fast::File.new path the_file.read if the_file.exist? the_file else Fast::File.new end end |