Module: Fast
- Defined in:
- lib/fast/dir.rb,
lib/fast/fast.rb,
lib/fast/file.rb,
lib/fast/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.3"
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)
6 7 8 9 10 11 12 13 14 |
# File 'lib/fast/fast.rb', line 6 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
17 18 19 |
# File 'lib/fast/fast.rb', line 17 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>`)
39 40 41 |
# File 'lib/fast/fast.rb', line 39 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)
22 23 24 25 26 27 28 29 30 |
# File 'lib/fast/fast.rb', line 22 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 |