Module: Dusel
- Defined in:
- lib/dusel.rb,
lib/dusel/version.rb,
lib/dusel/instance_methods.rb
Overview
Defined Under Namespace
Modules: InstanceMethods
Constant Summary collapse
- VERSION =
"0.1.2"
Class Method Summary collapse
-
.dir(name = nil, parent = nil, &block) {|dir| ... } ⇒ Dir
Creates a new directory.
-
.file(name = nil, parent = nil, &block) {|file| ... } ⇒ File
Creates a new file.
Class Method Details
.dir(name = nil, parent = nil, &block) {|dir| ... } ⇒ Dir
Note:
When using an implicit parent, the parent will not be removed during Dusel::InstanceMethods#collapse
Creates a new directory
47 48 49 50 51 |
# File 'lib/dusel.rb', line 47 def self.dir(name = nil, parent = nil, &block) parent ||= Dir.mktmpdir() parent = parent.path if parent.kind_of?(Dir) Dir.open(parent).dir(name, &block) end |
.file(name = nil, parent = nil, &block) {|file| ... } ⇒ File
Note:
When using an implicit parent, the parent will not be removed during Dusel::InstanceMethods#collapse
Note:
In case a block of arity == 0 is passed, the block’s value will be written to the file. The file is rewinded afterwards
Creates a new file
97 98 99 100 101 |
# File 'lib/dusel.rb', line 97 def self.file(name = nil, parent = nil, &block) parent ||= Dir.mktmpdir() parent = parent.path if parent.kind_of?(Dir) Dir.open(parent).file(name, &block) end |