Class: Pansophy::Local::Directory
- Inherits:
-
Object
- Object
- Pansophy::Local::Directory
- Includes:
- Adamantium
- Defined in:
- lib/pansophy/local/directory.rb
Instance Method Summary collapse
- #create(options) ⇒ Object
- #create_file(path, body, options = {}) ⇒ Object
- #files ⇒ Object
-
#initialize(path) ⇒ Directory
constructor
A new instance of Directory.
- #pathname ⇒ Object
Constructor Details
#initialize(path) ⇒ Directory
Returns a new instance of Directory.
6 7 8 9 |
# File 'lib/pansophy/local/directory.rb', line 6 def initialize(path) @path = path verify_directory! end |
Instance Method Details
#create(options) ⇒ Object
20 21 22 23 |
# File 'lib/pansophy/local/directory.rb', line 20 def create() remove() pathname.mkpath end |
#create_file(path, body, options = {}) ⇒ Object
25 26 27 |
# File 'lib/pansophy/local/directory.rb', line 25 def create_file(path, body, = {}) CreateFile.new(pathname.join(path), body).call() end |
#files ⇒ Object
16 17 18 |
# File 'lib/pansophy/local/directory.rb', line 16 def files entries.select(&:file?).map { |file| File.new(file) } end |
#pathname ⇒ Object
11 12 13 |
# File 'lib/pansophy/local/directory.rb', line 11 def pathname Pathname.new(@path) end |